CSV Parser and unusual (?) linesterminator - misunderstanding?

Peter Otten __peter__ at web.de
Fri Jan 20 06:32:21 EST 2006

Tino Lange wrote:

>>> I'm trying to use the csv Parser included with Python. Field Delimiter
>>> is "|", Line Delimiter is "#". Unfortunately it doesn't work as
>>> expected. The parser seems to just ignore the 'lineterminator'?
>> The csv reader accepts '\r' '\r\n' or '\n' as line endings, even mixed in
>> the same file. This behaviour is hardcoded. Only the writer uses the
>> lineterminator specified in the dialect.
> Boah ... Really?
> a) this is not in the documentation ... or did I oversee something?

It's only in the development version of the documentation, see


> b) this is really unacceptable, or? At least we here have many CSV's with
> other lineterminators than '\n'.

Do you need the elaborate (read: odd) escaping techniques of the original
CSV for these? Or would [row.split(fieldsep) for row in
data.split(linesep)] work just as well?

> Is this going to be changed? Is someone working on it? Or are patches for
> SF wanted?

I would think so.


More information about the Python-list mailing list