python 3-ba így néz ki:
import sys,os
file=sys.argv[1]
infile=open(file,'r')
words=[word for word in infile]
words=list(set(words))
words.sort()
outfile=open('sortedwords.txt','w')
outfile.writelines(words)
infile.close()
outfile.close()
ezt beírod egy py végű szöveges filébe aztán így indítod:
python3 wordsorting.py words.txt