\r for newline in readlines function

David Eppstein eppstein at ics.uci.edu
Fri Sep 19 19:54:59 CEST 2003


In article <mailman.1063989509.22137.python-list at python.org>,
 "Leeds, Mark" <mleeds at mlp.com> wrote:

> I did more investigation into my previous problem
> and what happens is that my text file has \r for representing
> a new line instead
> of a \n. is there a way to tell the readlines
> function that the symbol for a newline is \r rather
> than \n ? right now the readlines function reads
> the\r as another item in the list and just puts
> everything into one big list because it
> doesn't find any new line characters.
>  thanks. i'm really stuck because
> i can't read my data right now.

Isn't this exactly what the new universal newline format is for?
<http://www.python.org/peps/pep-0278.html>

-- 
David Eppstein                      http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science




More information about the Python-list mailing list