[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: Text file with mixed end-of-line terminations
From:       Chris Rebert <clp2 () rebertia ! com>
Date:       2011-08-31 19:58:36
Message-ID: CAMZYqRSrGA=Aoo=GjMzOU8meiv9tQskH+CwJ2E+bqWgBvFDXVA () mail ! gmail ! com
[Download RAW message or body]

On Wed, Aug 31, 2011 at 12:37 PM, Alex van der Spek <zdoor@xs4all.nl> wrote:
> I have a text file that uses both '\r' and '\r\n' end-of-line terminations.
>
> The '\r' terminates the first 25 lines or so, the remainder is termiated
> with '\r\n'
<snip>
> Is there a way to make it read one line at a time, regardless of the line
> termination?

Universal Newline Support
http://www.python.org/dev/peps/pep-0278/

http://docs.python.org/library/functions.html#open
(Modes involving "U")

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic