I have a CSV file with 5 columns. Using Python, how can I delete the last column (header5 in the example)? Is there an easy way I\'m missing, or do I have to loop through al
Even if you don't use CSV module, the logical and sane way is to read the file row by row, split them on comma, and print out item 1 through 4 with a join. eg
for line in open("file"):
print ','.join( line.split(",")[:-1] )
Or just by simple string indexing
for line in open("file"):
print line[ : line.rindex(",") ]