Martin Panter <vadmium...@gmail.com> added the comment:

This is the result that I see:

>>> output = StringIO()
>>> csv.writer(output, lineterminator='\n').writerow(["Whoa!\rNewlines!"])
16
>>> output.getvalue()
'Whoa!\rNewlines!\n'

For comparison, this is the result with CRLF terminators (the default):

>>> output = StringIO()
>>> csv.writer(output, lineterminator='\r\n').writerow(["Whoa!\rNewlines!"])
19
>>> output.getvalue()
'"Whoa!\rNewlines!"\r\n'

Is it a problem that the line terminator determines whether the CR is quoted or 
not? I believe the default policy is “excel”, which happens to use 
QUOTE_MINIMAL. This behaviour is documented: 
<https://docs.python.org/3.7/library/csv.html#csv.QUOTE_MINIMAL>.

----------
nosy: +martin.panter
resolution:  -> not a bug
status: open -> pending

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36246>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to