parsing - Python strip every double quote from csv -
hi have csv file looks following.
"ab" ; "aa" ; "ba" ; "hi" "cd" ; "bb" ; "bc" ; "jk" "ef" ; "cc" ; "ce" ; "lm" "gh" ; "dd" ; "dg" ; "mn"
how can following code strip off double quotes every column in csv file strips first column. thanks
import csv f = open("wakhawakha.csv", 'rt') try: row in csv.reader(f, delimiter=' ', skipinitialspace=true): print('|'.join(row)) finally: f.close()
open , read string first.
import csv open("wakhawakha.csv", 'rt') f: data = f.read() new_data = data.replace('"', '') row in csv.reader(new_data.splitlines(), delimiter=' ', skipinitialspace=true): print ('|'.join(row))
Comments
Post a Comment