To strip first/last line, you can convert the csv.reader to list and then use [1:-1] on it. For example:

import csv

with open('test.csv', 'r') as csvfile:
    f = csv.reader(csvfile, delimiter=',')
    for line in list(f)[1:-1]:  # [1:-1] to strip first/last line from csv
        print (line)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top