I have a text file with many words repeated. I need every word in the file to appear only once.
import codecs
wordList = codecs.open('Arquivo.txt' , 'r')
wordList2 = codecs.open('Arquivo2.txt', 'w')
for x in range(len(wordList)) :
for y in range(x + 1, len(wordList ) ):
if wordList[x] == wordList[y]:
wordList2.append(wordList[x] )
for y in wordList2:
wordList.remove(y)
Error submitted
for x in range(len(wordList)):
TypeError: object of type 'file' has no len()