New submission from Bill Fenner:

When a field has internal line breaks, e.g.,

foo,"bar
baz
biff",boo

that is actually 3 lines, but one csv-file row.  csv.reader() converts 
this to ['foo', 'bar\nbaz\nbiff', 'boo'].  This is a reasonable 
behavior.

Unfortunately, csv.writer() does not use the dialect's lineterminator 
setting for values with such internal linebreaks.  This means that the 
resulting file will have a mix of line-termination styles:

foo,"bar\n
baz\n
biff",boo\r\n

If the reading csv implementation is strict about its line termination, 
these line breaks will not be read properly.

----------
messages: 57902
nosy: fenner
severity: normal
status: open
title: csv input converts \r\n to \n but csv output does not when a field has 
internal line breaks
type: behavior
versions: Python 2.4

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1511>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to