Saturday, 14 September 2013

how to sort this python code alphabetically

how to sort this python code alphabetically

i've tried so hard to sort these code alphabetically but still not
working. tis is the error message :
Traceback (most recent call last): File "D:\Eclipse
Workspace\tugas1\src\h.py", line 15, in for word in set(l): TypeError:
'NoneType' object is not iterable
here the code :
from re import compile
l=compile("(\w[\w']*)").findall(open(raw_input('Input file:
'),'r').read().lower()).sort()
f=open(raw_input('Output file: '),'w')
for word in set(l):
print>>f, word, ':', '\t', l.count(word), 'kata'
f.close()

No comments:

Post a Comment