How to delete columns in a CSV file?

import csv with open(“source”,”rb”) as source: rdr= csv.reader( source ) with open(“result”,”wb”) as result: wtr= csv.writer( result ) for r in rdr: wtr.writerow( (r[0], r[1], r[3], r[4]) ) BTW, the for loop can be removed, but not really simplified. in_iter= ( (r[0], r[1], r[3], r[4]) for r in rdr ) wtr.writerows( in_iter ) Also, you … Read more