On Jan 11, 6:53 pm, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On 1/11/2011 7:22 PM, eblume wrote: > > > <snip> > > reader_iter = iter(self.reader) > headers = reader_iter.next() > # intermediate code > for line in reader_iter: > data.append(line) > return data > > Also note that recommended best practice is to wrap the "headers = > reader_iter.next()" line in a try-except in case it raises a > StopIteration. Otherwise it could get propagated silently up to some > unrelated for loop higher in the stack, resulting in unexpected behavior. > > Cheers, > Ian
That's brilliant, exactly the code I was looking for. Thanks very much Ian! Erich -- http://mail.python.org/mailman/listinfo/python-list