0
I have a function that counts 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 that information to be stored in the file and for that 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 above code is created the file I invoke, but save this way:
melancólicarÞ KX tivesterß KX distraçãorà KX
What am I doing wrong?