Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def uniqueWords(inFile,outFile):
- inf = open(inFile,'r')
- outf = open(outFile,'w')
- for line in inf:
- wordlst = line.split()
- count = len(wordlst)
- outf.write(str(count)+'n')
- inf.close()
- outf.close()
- uniqueWords('turn.txt','turnout.txt')
- def uniqueWords(inFile,outFile):
- inf = open(inFile,'r')
- outf = open(outFile,'w')
- unique = []
- for line in inf:
- wordlst = line.split()
- for word in wordlst:
- if word not in unique:
- unique.append(word)
- outf.write(str(len(unique)))
- inf.close()
- outf.close()
- uniqueWords('turn.txt','turnout.txt')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement