I have a CSV file with data like the following:
a,b,c,d,e,f
0,0,AER,0,DME,0
0,0,ASF,0,LED,0
How do I take inputs from columns C and E, and output them into something like:
I like [column C] and [column E]
I like [column C] and [column E]
example:
I like AER and DME
I like ASF and LED
Right now I have the following code:
import csv
header1 =['c']
header2 =['e']
with open('routes2.csv', 'rb') as csvfilein, open('out.csv', 'wb') as csvfileout:
reader = csv.DictReader(csvfilein)
writer1 = csv.DictWriter(csvfileout, header1, extrasaction='ignore')
writer2 = csv.DictWriter(csvfileout, header2, extrasaction='ignore')
for line in reader:
writer1.writerow(line), writer2.writerow(line)
I'm stuck at trying to figure out how to append the text to data from columns C and E. How would I do this?