Windows vs.

MRAB python at
Thu Sep 2 18:15:24 CEST 2010

On 02/09/2010 08:49, Lawrence D'Oliveiro wrote:
> In message<mailman.330.1283362312.29448.python-list at>, MRAB
> wrote:
>> You should open the files in binary mode, not text mode, ie file(path,
>> "rb"). Text mode is the default. Not a problem on *nix because the line
>> ending is newline.
> We used to pride ourselves on not having to worry about text versus binary
> I/O modes on *nix, but I’m beginning to think the reality is we have to
> adopt it.
> To start with, it means we can automatically handle different newline
> conventions with text files originating on different systems.

In Python 3 the difference is important because binary mode works with
bytes and text mode works with strings, plus the file encoding and line

More information about the Python-list mailing list