Windows vs. file.read

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Thu Sep 2 03:49:23 EDT 2010


In message <mailman.330.1283362312.29448.python-list at python.org>, 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.



More information about the Python-list mailing list