Possible Duplicate: When processing CSV data, how do I ignore the first line of data?
I am using python to open CSV file. I am using formula loop but I need to skip the first row because it has header.
So far I remember was something like this but it is missing something: I wonder if someone knows the code for what I am trying to do.
for row in kidfile:
if row.firstline = false: # <====== Something is missing here.
continue
if ......
There are many ways to skip the first line. In addition to those said by Bakuriu, I would add:
with open(filename, 'r') as f:
next(f)
for line in f:
and:
with open(filename,'r') as f:
lines = f.readlines()[1:]
csvreader.next() Return the next row of the reader’s iterable object as a list, parsed according to the current dialect.
Source: Stackoverflow.com