using DictReader() with .decode('utf-8', 'ignore')

Vincent Davis vincent at vincentdavis.net
Tue Apr 14 15:37:53 CEST 2015


> Which DictReader? Do you mean the one in the csv module? I will assume so.
>
​yes.​


>
> # untested
> with open(dfile, 'r', encoding='utf-8', errors='ignore', newline='') as f:
>     reader = csv.DictReader(f)
>     for row in reader:
>         print(row['fieldname'])
>

What you have seems to work, now I need to go find my strange symbols that
are not ​'utf-8' and see what happens
I was thought, that I had to open with 'rb' to use ​encoding?


Vincent Davis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150414/8eca4863/attachment.html>


More information about the Python-list mailing list