b holds the contents of a csv file
i need to go through every row of b; however, since it has a header, i dont want to pay attention to the header. how do i start from the second row?
for row in b (starting from the second row!!):
b holds the contents of a csv file
i need to go through every row of b; however, since it has a header, i dont want to pay attention to the header. how do i start from the second row?
for row in b (starting from the second row!!):
b.next()
for row in b:
# do something with row
But consider using the csv module, especially with DictReader.
Easiest way is to use a DictReader. It will consume the first row for you
Prepend a next(b)
(in every recent version of Python; b.next()
in older ones) to skip the first row (if b
is an iterator; if it is, instead, a list, for row in b[1:]:
, of course).