Here is a file "test.csv"
number,name,des cription,value
1,"wer","tape 2"",5
1,vvv,"hoohaa", 2
I want to convert it to tab-separated without those silly quotes. Note
in the second line that a field is 'tape 2"' , ie two inches: there is
a double quote in the string.
When I use csv module to read this:
import sys
outf=open(sys.a rgv[1]+'.tsv','wt')
import csv
reader=csv.read er(open(sys.arg v[1], "rb"))
for row in reader:
outf.write('\t' .join([rr.strip() for rr in row]) +'\n')
it mangles it, messing up the double double-quote.
Can anyone help me? How do I use CSV to get it right?
Tjhanks!
c
number,name,des cription,value
1,"wer","tape 2"",5
1,vvv,"hoohaa", 2
I want to convert it to tab-separated without those silly quotes. Note
in the second line that a field is 'tape 2"' , ie two inches: there is
a double quote in the string.
When I use csv module to read this:
import sys
outf=open(sys.a rgv[1]+'.tsv','wt')
import csv
reader=csv.read er(open(sys.arg v[1], "rb"))
for row in reader:
outf.write('\t' .join([rr.strip() for rr in row]) +'\n')
it mangles it, messing up the double double-quote.
Can anyone help me? How do I use CSV to get it right?
Tjhanks!
c
Comment