Cursed newlines and readline()
Thomas Wouters
thomas at xs4all.net
Fri Sep 13 09:27:30 EDT 2002
On Thu, Sep 12, 2002 at 06:59:14PM +0000, Edward K. Ream wrote:
> According to one of Leo's Linux users, the Python's readline() routine on
> Linux delivers "\r\n" line end strings verbatim, while the windows versions
> force the string to use the Unix convention of using only "\n". This seems
> unfortunate. Is there a justification for it? If not, I would like to
> suggest that readline() work the same on all platforms and that it deliver
> only "\n" as a line terminator.
You can open the file in 'binary' mode (adding 'b' to the mode string) and
the file will contain '\r\n' on both platforms (and any other platforms.)
--
Thomas Wouters <thomas at xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
More information about the Python-list
mailing list