Iterate from 2nd element of a huge list
Peter Otten
__peter__ at web.de
Wed Feb 1 03:11:44 EST 2012
Arnaud Delobelle wrote:
>> Em 01-02-2012 01:39, Paulo da Silva escreveu:
>>> What is the best way to iterate thru a huge list having the 1st element
>>> a different process? I.e.:
> Nobody mentioned itertools.islice, which can be handy, especially if
> you weren't interested in the first element of the list:
Also, skipping two or seven or ... items is just as easy.
The example should be
> from itertools import islice:
for el in islice(mylist, 1, None):
> process2(el)
More information about the Python-list
mailing list