python - What's the Pythonic way to loop through an iterator when the first few values are special? -


the standard away is:

it = iter(sequence) value in it:     print value 

i'm using third party library returns iterator first value being header, second value being metadata , rest of values being records. have tried like:

db = dbfreader(f) headers = db.next() spec =  db.next() record = db.next() while record:     print record     record = db.next() 

but results in stopiteration error

the first record not special, it's first of records, there's no reason read ahead of time.

db = dbfreader(f) headers = db.next() spec =  db.next() record in db:     print record 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

php - HTTP_REFERER woes: How can I allow access to a specific page, only when a visitor has visited another specific page beforehand? -