\r for newline in readlines function

Skip Montanaro skip at pobox.com
Fri Sep 19 13:25:49 EDT 2003


    Mark> I did more investigation into my previous problem and what happens
    Mark> is that my text file has \r for representing a new line instead of
    Mark> a \n.

Trying to process a file generated on a Mac, perhaps?  Try opening the file
with universal newline mode:

    f = file("somefile.txt", "rU")

Skip





More information about the Python-list mailing list