Python 2.1 / 2.3: xreadlines not working with codecs.open

Richard Brodie R.Brodie at rl.ac.uk
Tue Jun 28 09:56:47 EDT 2005


"Eric Brunel" <eric_brunel at despammed.com> wrote in message news:opss2ywss0rqur0o at eb.pragmadev...
>
> Replying to myself. One more funny thing:
>
> >>> import codecs, xreadlines
> >>> f = codecs.open('foo.txt', 'r', 'utf-8', 'replace')
> >>> [l for l in xreadlines.xreadlines(f)]
> [u'\ufffd\ufffd']

You've specified utf-8 as the encoding instead of iso8859-1,
by the way.





More information about the Python-list mailing list