readline() with arbitrary end of lines

Rainer Deyke root at
Sun Sep 10 18:48:28 CEST 2000

"Javier Bezos" <see.below at> wrote in message
news:1egcl2y.1rzwdz01k9rsh8N%see.below at
> Hello,
> I'm using MacPython 1.5.2c1 to read several files with
> the help of readline(). However, the files to be read can
> have either Mac or Unix end of lines and it seems that only
> Mac end of lines are recognized; changing linesep has no
> effect at all.

Quick hack: open file in binary mode.

a = open("test.txt", "rb")

Of course that means that you can no longer read Mac files.

Rainer Deyke (root at
Shareware computer games           - 
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor

More information about the Python-list mailing list