Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #12523

Re: Text file with mixed end-of-line terminations

References <4e5e8d71$0$2554$e4fe514c@news2.news.xs4all.nl>
Date 2011-08-31 12:58 -0700
Subject Re: Text file with mixed end-of-line terminations
From Chris Rebert <clp2@rebertia.com>
Newsgroups comp.lang.python
Message-ID <mailman.631.1314820719.27778.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Text file with mixed end-of-line terminations "Alex van der Spek" <zdoor@xs4all.nl> - 2011-08-31 21:37 +0200
  Re: Text file with mixed end-of-line terminations Chris Rebert <clp2@rebertia.com> - 2011-08-31 12:58 -0700
  Re: Text file with mixed end-of-line terminations woooee <woooee@gmail.com> - 2011-09-01 12:17 -0700

csiph-web