2
I have a python script that takes words from a ". txt" file through the open method and puts them in a list. However, if the word in the text file has some accent, when passed to the list in python the accent turns "Äe" for example. I’d like to know how I can stop that problem from happening.
txt file
Até!
Tchau!
Nunca é um adeus!
Fui!
Python excerpt
chats = open('dialogo/'+ arquivos, 'r').readlines()
When I give print()
on the chat list, accentuated characters come defaced from txt file.
Python by default opens the file with UTF-8 encoding. The file was created with this encoding?
– Woss
Yes, the encoding is already in UTF-8...
– user122904