I am uploading a csv file in utf-8 encoding (I set the encoding via notepad ++).

When you open the csv file and display the line, it shows this: Р ”Р” РёРЅР °: СтР° РЅРґР ° СЂС‚РЅС ‹Р№ (L)

should it: Length: Elongated (L)

with open("./xls/mainCSV_utf.csv") as f_obj: read_csv(f_obj) def read_csv(f_obj) reader = csv.DictReader(file_obj, delimiter=';') for line in reader: print(line["value"]) 
  • one
    Well, you forgot to tell the python that the file has a utf-8 encoding, so he is trying to read what encoding is in - andreymal
  • the coding is, that's just the point - Yegor Lapitsky
  • No, not worth it. Here in the answer from Sergey Gornostaev is worth - andreymal

1 answer 1

You must specify the file encoding when opening it.

 with open("./xls/mainCSV_utf.csv", encoding='utf-8') as f_obj: 

or system will be used. In the case of a system mismatch with the actual, get krakozyabry.