using of this CSV module line-by-line
infname = "csv.csv"
outfname = "csv_stripped.csv"
cols = ["col1", "col2", "col3"]
with open(infname) as inf, open(outfname, 'w+') as outf:
reader = csv.DictReader(inf)
writer = csv.DictWriter(outf, cols, extrasaction='ignore')
for line in reader:
know about them please click here: https://docs.python.org/2/library/csv.html
it will assist you in resolving issues.