[Tutor] input file encoding

Tim Michelsen timmichelsen at gmx-topmail.de
Tue Sep 11 16:22:25 CEST 2007


> Not sure what you mean by "standard encoding" (is this an Ubuntu
> thing?) but essentially whenever you're pulling stuff into Python
As it was lined out by others I was printing to a linux terminal which 
had the encoding set to UTF-8.
Therefore and for further processing of the data I had to open it with 
the right encoding.


> In this case, assuming you have files in iso-8859-1, something
> like this:
> 

> <code>
> import codecs
> 
> filenames = ['a.txt', 'b.txt', 'c.txt']
> for filename in filenames:
>    f = codecs.open (filename, encoding="iso-8859-1")
This piece of code did the trick. After a short adaption I had exactly 
what I wanted to achive.


Thanks you for your help.



More information about the Tutor mailing list