Python pickle doesn't print out characters such as 'â,é,è,æ'
I am not very familiar with programing jargon, so bear with me.
I'm making a language program that has to be able to save and read from a
file text that contains utf-8 characters.
I'm using pickle
WORDS = [['eat','manger','v'],['drink','boire','v'],
["cake",'le gateau','n'],['coffee','le café','n']]
wordDatabase = open('wordsForProgram.txt','wb')
pickle.dump(WORDS,wordDatabase)
wordDatabase.close()
inFile = open('wordsForProgram.txt','rb')
newList = pickle.load(inFile)
print(newList)
It prints out:
[['eat', 'manger', 'v'],
['drink', 'boire', 'v'],
['cake', 'le gateau', 'n'],
['coffee', 'le café', 'n']]
The list in the script also changes 'le café' to 'le café'. When I change
it back it works again until I close and reopen the script.
Thanks!
No comments:
Post a Comment