I have a list of 5000 words in UNICODE format. how can I sort them after appending new words into it ???
a = []
for word in text:
if word not in dic:
misspelled = word
a.append(misspelled)
foo =misspelled
f = open('test.txt', 'a')
f.write(foo.encode('utf8'))
x='\n'
f.write(x.encode('utf8'))
f.close()
Just sort them calling .sort:
You should also open the file once and use
with
to open your files: