2009/11/7 MRAB <pyt...@mrabarnett.plus.com>

> Baptiste Lepilleur wrote:
>
 [..]
>> Do I need to replace all codecs.open with the built-in open function? If
>> so, why does codecs.open still exist?
>>
>>  The documentation says of codecs.open() that "Files are always opened in
> binary mode, even if no binary mode was specified", but you've given the
> mode as 'rt', so you're asking it to open the file both in text mode
> _and_ binary mode. This is the same as in Python 2.6.
>
> If it works in 2.6 but not in 3.1, perhaps it's just that in 2.6 it
> ignores the 't' whereas in 3.1 it complains.
>

So I did miss something, but it was in 2.6. Thanks for the clarification.

Though, I think the documentation is somewhat confusing in 3.x as it says
that it opens the file in binary mode, but the opened file iterator returns
str not bytes...
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to