source: trunk/essentials/dev-lang/python/Doc/ref/reswords.py

Last change on this file was 3225, checked in by bird, 19 years ago

Python 2.5

File size: 515 bytes
Line 
1"""Spit out the Python reserved words table."""
2
3import keyword
4
5ncols = 5
6
7def main():
8 words = keyword.kwlist[:]
9 words.sort()
10 colwidth = 1 + max(map(len, words))
11 nwords = len(words)
12 nrows = (nwords + ncols - 1) / ncols
13 for irow in range(nrows):
14 for icol in range(ncols):
15 i = irow + icol * nrows
16 if 0 <= i < nwords:
17 word = words[i]
18 else:
19 word = ""
20 print "%-*s" % (colwidth, word),
21 print
22
23main()
Note: See TracBrowser for help on using the repository browser.