This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skip.montanaro
Recipients georg.brandl, skip.montanaro, techtonik
Date 2008-07-17.01:01:35
SpamBayes Score 0.0054672346
Marked as misclassified No
Message-id <18558.39404.884345.328631@montanaro-dyndns-org.local>
In-reply-to <1216148745.81.0.952117625519.issue3359@psf.upfronthosting.co.za>
Content
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
History
Date User Action Args
2008-07-17 01:01:38skip.montanarosetspambayes_score: 0.00546723 -> 0.0054672346
recipients: + skip.montanaro, georg.brandl, techtonik
2008-07-17 01:01:36skip.montanarolinkissue3359 messages
2008-07-17 01:01:35skip.montanarocreate