Forum Archive

Reading utf-8 csv-file throws ascii error

chri

I am trying to read a csv-file. Both python and csv-file are stored on icloud.
But Pythonista cannot read the file. Any ideas what causes this?
I posted a screenshot here: https://imgur.com/a/RYnvJ

Thank you!

# coding: utf-8 

import csv
with open('file.csv', 'r') as f:
    reader = csv.reader(f)
    city_list = list(reader)
brumm
with open('file.csv', 'r', encoding='utf-8') as f:
chri

@brumm thanks, that did it