\r for newline in readlines function

Bob Gailer bgailer at alum.rpi.edu
Fri Sep 19 18:47:56 CEST 2003


At 10:37 AM 9/19/2003, Leeds, Mark 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.

bigList = foo.readlines()
niceList = bigList.split('\r')

Bob Gailer
bgailer at alum.rpi.edu
303 442 2625

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20030919/9d8556ec/attachment.html>
-------------- next part --------------

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.506 / Virus Database: 303 - Release Date: 8/1/2003


More information about the Python-list mailing list