for loop
Steven Bethard
steven.bethard at gmail.com
Sun Dec 12 12:27:20 EST 2004
houbahop wrote:
> for i=morethanzero to n
for i in range(morethanzero, n):
...
> for i= 5 to len(var)
for i in range(5, len(var)):
...
although range(len(var)) is usually not what you want, because you can
just do:
for item in itertools.islice(var, 5, None):
...
or if you really do need the index too:
for i, item in itertools.islice(enumerate(var), 5, None):
...
Steve
More information about the Python-list
mailing list