John Machin <[email protected]> added the comment:
... and it looks like Option 2 might already *almost* be in place.
Continuing with the previous example (book1.csv has embedded lone LFs):
C:\devel\csv>\python30\python -c "import csv;
print(repr(list(csv.reader(open('book1.csv','rt', encoding='ascii')))))"
[['Field1', 'Field 2 has a\nvery long\nheading', 'Field3'], ['1.11',
'2.22', '3.33']]
Looks good. However consider book2.csv which has embedded CRLFs:
C:\devel\csv>\python30\python -c "print(repr(open('book2.csv',
'rb').read()))"
b'Field1,"Field 2 has a\r\nvery
long\r\nheading",Field3\r\n1.11,2.22,3.33\r\n'
This gives:
C:\devel\csv>\python30\python -c "import csv;
print(repr(list(csv.reader(open('book2.csv','rt', encoding='ascii')))))"
[['Field1', 'Field 2 has a\nvery long\nheading', 'Field3'], ['1.11',
'2.22', '3.33']]
Not good. It should preserve ALL characters in the field.
----------
message_count: 11.0 -> 12.0
versions: +Python 3.1
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue4847>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com