skip next item in list
Diez B. Roggisch
deets at nospam.web.de
Mon Jun 11 11:19:38 EDT 2007
ahlongxp wrote:
> list=('a','d','c','d')
> for a in list:
> if a=='a' :
> #skip the letter affer 'a'
>
> what am I supposed to do?
First - don't use list as name, as it is a builtins-name and shadowing is
likely to produce errors at some point.
list_iterator = iter(('a','d','c','d'))
for a in list_iterator:
if a == 'a':
list_iterator.next()
...
should do the trick.
Diez
More information about the Python-list
mailing list