Hi I have a csv file that looks like the following.
"AB" ; "AA" ; "BA" ; "HI"
"CD" ; "BB" ; "BC" ; "JK"
"EF" ; "CC" ; "CE" ; "LM"
"GH" ; "DD" ; "DG" ; "MN"
How can I get the following code to strip off all the double quotes from every column in a csv file as for now it strips only the first column. Thanks
import csv
f = open("wakhawakha.csv", 'rt')
try:
for row in csv.reader(f, delimiter=' ', skipinitialspace=True):
print('|'.join(row))
finally:
f.close()
Open it and read the string first.
Is this what you wanted?
EDIT I noticed you changed your indentation. The indentation in your OP was wrong: Now it's fine:
This way the output is this:
Is this the output you wanted? Or, did you just want to strip off all the double quotes? If so, then change this line in your code:
to this:
Then you will get this output: