In <[EMAIL PROTECTED]>, Ramon Felciano
wrote:

> Hi --
> 
> I'm using the csv module to parse a tab-delimited file and wondered
> whether there was a more elegant way to skip an possible header line.
> I'm doing
> 
>       line = 0
>       reader = csv.reader(file(filename))
>       for row in reader:
>               if (ignoreFirstLine & line == 0):
>                       continue
>               line = line+1
>               # do something with row

What about:

  reader = csv.reader(file(filename))
  reader.next()  # Skip header line.
  for row in reader:
      # do something with row

Ciao,
        Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to