[Csv] PEP 305
Gregory Bond
gnb at itga.com.au
Mon Jun 7 06:34:05 CEST 2004
I've a problem that I can't make the new CSV module fix - embedded \r's in
fields. I'm parsing a format that allows \r and \n to be part of a field, if
the field is quoted with "". Looking at Modules/_csv.c, this is probably
impossible....
(Python 2.3.1)
Take the following:
meldev$ cat tcsv.py
import csv
d = 'fld1,fld2,"fld3 ",fld4\r\n'
d2 = 'fld1,fld2,"fld3 \r",fld4\r\n'
r = csv.reader([d, d2])
for f in r:
print f
meldev$ python tcsv.py
['fld1', 'fld2', 'fld3 ', 'fld4']
Traceback (most recent call last):
File "tcsv.py", line 9, in ?
for f in r:
_csv.Error: newline inside string
More information about the Csv
mailing list