The following code results in a string that I want to remove:
with open('company_inf1.csv', 'rb') as inf :
reader = csv.reader(inf, delimiter=',')
reader.next() #skip header
for i,row in enumerate(reader):
name, date, indus, nike1, nike2, nike3, paid, abbr = row
t = (map(str, (nike1, nike2, nike3)),) # map & merge the 3 cols together\
b = str(t) [1:-1]
c = b.replace('"', '\\"')
print( name, date, indus, b , paid, abbr)
My output is
('abc', '30-06-1987', 'Service', "['nike1', 'nike2', 'nike3 '],", '100',
'abs')
I also want to remove the double quotes, so that the output become:
<output missing from OP>
I have already tried with replace
and strip
commands, but it did not work for me. I also want to save the test where I am printing the value of b
into a test file. How can I do this?