How to read a csv file with accentuated characters and transfer this data to a dictionary?

Asked

Viewed 572 times

0

I have a csv file separated by ";" with two columns exported via excel:

1) Name of the person

2) e-mail of the person.

However, the name contains accent and when trying to read the file and create the dictionary, python 3 (on macOS) gives error in for. How do I get around this? See the code and the error.

inserir a descrição da imagem aqui

  • 1

    You could not convert entire file to UTF8 instead of converting the contents of the lines ?

  • And do not post the code in image form, it makes it impossible to run the site search on the question.

  • Thanks for the tip. I will not post the codes anymore in image form.

  • Even when I open the file with Arq = open(folder + "emails_students.csv", "r", encoding = 'utf-8'), it gives error in the for. Only when I open with Arq = open(folder + "emails_students.csv", "r", encoding = 'utf-8', errors='ignore') does not give error but accented characters are ignored. How to maintain these accents.

No answers

Browser other questions tagged

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