mirror of
https://github.com/python/cpython
synced 2024-11-02 09:48:08 +00:00
ab3a2504b9
libstring.tex: added count(). ref2.tex: new keywords; moved keyword printing program to keywords.py.
20 lines
395 B
Python
20 lines
395 B
Python
#! /usr/local/bin/python
|
|
|
|
# This Python program sorts and reformats the table of keywords in ref2.tex
|
|
|
|
import string
|
|
l = []
|
|
try:
|
|
while 1:
|
|
l = l + string.split(raw_input())
|
|
except EOFError:
|
|
pass
|
|
l.sort()
|
|
for x in l[:]:
|
|
while l.count(x) > 1: l.remove(x)
|
|
ncols = 5
|
|
nrows = (len(l)+ncols-1)/ncols
|
|
for i in range(nrows):
|
|
for j in range(i, len(l), nrows):
|
|
print string.ljust(l[j], 10),
|
|
print
|