[Tutor] name shortening in a csv module output

Jim Mooney cybervigilante at gmail.com
Thu Apr 23 12:37:11 CEST 2015


..

> Ï»¿
>
> is the UTF-8 BOM (byte order mark) interpreted as Latin 1.
>
> If the input is UTF-8 you can get rid of the BOM with
>
> with open("data.txt", encoding="utf-8-sig") as csvfile:
>

Peter Otten

I caught the bad arithmetic on name length, but where is the byte order
mark coming from? My first line is plain English so far as I can see - no
umlauts or foreign characters.
first_name|last_name|email|city|state or region|address|zip

Is this an artifact of csv module output, or is it the data from
generatedata.com, which looks global? More likely it means I have to figure
out unicode ;'(


More information about the Tutor mailing list