Skip Montanaro <[EMAIL PROTECTED]> added the comment:
anatoly> If you open file with 'r' - all line endings will be mapped
anatoly> precisely to '\n' anyways, so it has nothing to do with 'U'
anatoly> mode.
Before 3.0 at least, if you copy a text file from, say, Windows to Mac, and
open it with 'r', you get lines which end in '\r\n'. Here's a simple
example:
>>> open("dos.txt", "rb").read()
'a single line\r\nanother line\r\n'
>>> f = open("dos.txt")
>>> f.next()
'a single line\r\n'
>>> f = open("dos.txt", "r")
>>> f.next()
'a single line\r\n'
>>> f.next()
'another line\r\n'
If, on the other hand, you open it with 'rU', the '\r\n' literal line ending
is converted, even though CRLF is not the canonical Mac line ending:
>>> f = open("dos.txt", "rU")
>>> f.next()
'a single line\n'
>>> f.next()
'another line\n'
Skip
_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3359>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com