issue with CVS module

Fillmore fillmore_remove at hotmail.com
Fri Mar 11 15:49:31 EST 2016


On 3/11/2016 2:41 PM, Fillmore wrote:
> Is there some directive I can give CVS reader to tell it to stop
> screwing with my text?

OK, I think I reproduced my problem at the REPL:

 >>> import csv
 >>> s = '"Please preserve my doublequotes"\ttext1\ttext2'
 >>> reader = csv.reader([s], delimiter='\t')
 >>> for row in reader:
...     print(row[0])
...
Please preserve my doublequotes
 >>>

:(

How do I instruct the reader to preserve my doublequotes?

As an aside. split() performs the job correctly...

 >>> allVals = s.split("\t")
 >>> print(allVals[0])
"Please preserve my doublequotes"
 >>>





More information about the Python-list mailing list