+ 2
How to savely store unicode in a potentially huge and often changed file
My vocabulary-learning script does some strange things. One of them is: Umlauts, asian symbols or other unicode stuff sometimes isn't stored correctly, it comes back distorted when I reaccess the file. How can I reliably prevent this? Up to now I have used txt-files and py-files (because txt doesn't seem to work on android). What would be the best simple solution? Some kind of encoding? Pickle? Something else?
1 Respuesta
+ 1
pass the binary write as a second arguemant e.g:
file = open('langs.html', 'wb')--> when writing to file
file = open('langs.html', 'rb')--> when reading from file