How to show accents in python?

Asked

Viewed 1,711 times

1

I’m needing to read a file of names in python, but they’re full of accents, I’m using this to open

arquivo = open('dadostxt/Nomes.txt', 'r', encoding='utf-8')

i put utf-8 in encoding, but when I go to excel or take a print, in place of the accents it comes with question mark, has how to solve this?

example of output

{'nome': 'Aid�e Dias', 'idade': 33, 'email': 'Aid�e [email protected]', 'salario': 4473.75}
  • 1

    The.txt Names file was saved with UTF-8 encoding?

1 answer

3

Try to put this at the beginning of your scheduled, on the first line:

#encoding: utf-8

Browser other questions tagged

You are not signed in. Login or sign up in order to post.