| Fred Drake | 2e1094e | 1999-04-09 14:53:35 +0000 | [diff] [blame] | 1 | #! /usr/bin/env python | 
| Guido van Rossum | ab3a250 | 1994-08-01 12:18:36 +0000 | [diff] [blame] | 2 |  | 
 | 3 | # This Python program sorts and reformats the table of keywords in ref2.tex | 
 | 4 |  | 
 | 5 | import string | 
 | 6 | l = [] | 
 | 7 | try: | 
 | 8 | 	while 1: | 
 | 9 | 		l = l + string.split(raw_input()) | 
 | 10 | except EOFError: | 
 | 11 | 	pass | 
 | 12 | l.sort() | 
 | 13 | for x in l[:]: | 
 | 14 | 	while l.count(x) > 1: l.remove(x) | 
 | 15 | ncols = 5 | 
 | 16 | nrows = (len(l)+ncols-1)/ncols | 
 | 17 | for i in range(nrows): | 
 | 18 | 	for j in range(i, len(l), nrows): | 
 | 19 | 		print string.ljust(l[j], 10), | 
 | 20 | 	print |