on Win32 -- converting my newlines to CR+LF

Chris Rebert clp2 at
Thu Aug 27 08:11:22 CEST 2009

On Wed, Aug 26, 2009 at 11:06 PM, Chris Rebert<clp2 at> wrote:
> On Wed, Aug 26, 2009 at 8:40 PM, Ryan McGuire<usenet at> wrote:
>> On Aug 26, 11:04 pm, Philip Semanchuk <phi... at> wrote:
>>> Try using "rb" instead of "r" for the mode in the call to open().
>>> HTH
>>> Philip
>> That does indeed fix the problem, thanks! Still seems like the docs
>> are wrong though.
> Yeah, the need to specify "b" does seem rather incongruous:
>, mode[, encoding[, errors[, buffering]]])
>    [...]
>    Note: Files are always opened in binary mode, even if no binary
> mode was specified. This is done to avoid data loss due to encodings
> using 8-bit values. This means that no automatic conversion of b'\n'
> is done on reading and writing.
> File a bug perhaps?:

Ah, I see you already did:

- Chris

More information about the Python-list mailing list