I want the text to be one key:count per line. Right now it saves the file just as a plain dictionary and I can't figure it out.
def makeFile(textSorted, newFile) :
dictionary = {}
counts = {}
for word in textSorted :
dictionary[word] = counts
counts[word] = counts.get(word, 0) + 1
# Save it to a file
with open(newFile, "w") as file :
file.write(str(counts))
file.close()
return counts