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
Post a Comment