How to iterate a sequence, with skipping the first item?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Aug 12 03:05:10 EDT 2008


En Tue, 12 Aug 2008 03:51:17 -0300, ray <hanlray at gmail.com> escribi�:

> A container object provides a method that returns an iterator object.
> I need to iterate the sequence with that iterator, but need to skip
> the first item. I can only iterate the whole sequence with:
> for x in container.iterChildren():
> How to skip the first item? It seems that it's a simple question.
> Could somebody help me? Thanks.

it = container.iterChildren()
it.next() # consume first item
for x in it:
   # process remaining items

-- 
Gabriel Genellina




More information about the Python-list mailing list