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


Groups > comp.lang.python > #53632

Re: Dealing with \r in CSV fields in Python2.4

Date 2013-09-04 10:32 -0500
From Tim Chase <python.list@tim.thechases.com>
Subject Re: Dealing with \r in CSV fields in Python2.4
References <20130904100403.163b42bd@bigbox.christie.dr> <CANc-5Uz1=_R3J4g5svRUJL0JpA8zGVQi+gkhjoc+FP7-tJN83g@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.49.1378308700.5461.python-list@python.org> (permalink)

Show all headers | View raw


On 2013-09-04 10:20, Skip Montanaro wrote:
> >   _csv.Error: newline inside string
> 
> How are the lines actually terminated, with \r\n or with just \n? If
> it's just \n, what happens if you specify \n as the line terminator?

Unfortunately, the customer feed contains DOS newlines ("\r\n").

I'm not quite sure what """
Note
The reader is hard-coded to recognize either '\r' or '\n' as
end-of-line, and ignores lineterminator. This behavior may change in
the future.
""" means at [1].  Does that mean that efforts to change the
lineterminator don't have any effect? Or that you can't (currently)
specify anything other than "\r" or "\n"?  Though that is a bit
tangent to the actual issue.

-tkc


[1] http://docs.python.org/2/library/csv.html



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


Thread

Re: Dealing with \r in CSV fields in Python2.4 Tim Chase <python.list@tim.thechases.com> - 2013-09-04 10:32 -0500

csiph-web