Pythonic use of CSV module to skip headers?
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Thu Dec 2 18:44:37 EST 2004
More information about the Python-list mailing list
Thu Dec 2 18:44:37 EST 2004
- Previous message (by thread): Pythonic use of CSV module to skip headers?
- Next message (by thread): Pythonic use of CSV module to skip headers?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In <76c29906.0412021521.64ea904f at posting.google.com>, 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
- Previous message (by thread): Pythonic use of CSV module to skip headers?
- Next message (by thread): Pythonic use of CSV module to skip headers?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list