I have a function that tells how many times the words appear:
def countWordExact(dataClean):
count = {}
dataFreq = []
for word in dataClean.split(" "):
if word in count:
count[word] += 1
else:
count[word] = 1
dataFreq.append(count)
return dataFreq
I need this information to be stored in the file and for this I do:
arq = open('novoGuarda.txt', 'w')
pickle.dump(data, arq)
arq.close()
data
is equivalent to dataFreq
. It comes from another function hence the name change.
With the code above I created the file that I invoke, but keep it this way:
melancólicarÞ KX tivesterß KX distraçãorà KX
What am I doing wrong?