Reading past the first three lines of a cvs file in python [duplicate]

A couple of slight modifications will help:

def open_temperature_file(filename):
    full_text = []
    csv_file = open(filename, 'r')

    reader = csv.reader(csv_file)
    for line in reader:
    return full_text[3:] # return lines, starting from line 3

On the return above, I used a list slice to discard the first couple of lines.

Browse More Popular Posts

Leave a Comment