Message337547
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>. |
|
Date |
User |
Action |
Args |
2019-03-09 00:09:35 | martin.panter | set | recipients:
+ martin.panter, flow2k |
2019-03-09 00:09:35 | martin.panter | set | messageid: <1552090175.29.0.572831505899.issue36246@roundup.psfhosted.org> |
2019-03-09 00:09:35 | martin.panter | link | issue36246 messages |
2019-03-09 00:09:35 | martin.panter | create | |
|