How to iterate a sequence, with skipping the first item?
Tue Aug 12 09:02:06 CEST 2008
ray <hanlray at gmail.com> writes:
> for x in container.iterChildren():
> How to skip the first item? It seems that it's a simple question.
> Could somebody help me? Thanks.
c = container.iterChildren()
c.next() # skip first item
for x in c: ...
from itertools import islice
for x in islice(container.iterChildren(), 1, None): ...
I like the second solution better but it's a matter of preference.
More information about the Python-list