In Excel, I would be able to use something like this:
with open("test.csv","rb") as source:
rdr= csv.reader( source )
with open("result","wb") as result:
wtr= csv.writer( result )
for r in rdr:
print("Adding merged COL1/COL2 into one column for every row...")
wtr.writerow(r+[r + ' ' + r])
print("Deleting COL1/COL2 columns from every row...")
wtr.writerow( r )
So every row you're reading from (and writing to) csv is a list, right? So take another step or two and create the list you want, then write it.
import csv with open('test.csv') as f: reader = csv.reader(f) with open('output.csv', 'w') as g: writer = csv.writer(g) for row in reader: new_row = [' '.join([row, row])] + row[2:] writer.writerow(new_row)
Also, I doubt you need to read/write binary ('rb', 'wb') from a csv.