python said : "1, 2, 3, 6, 7, manbo !"

Aloysio Figueiredo xpythonist at yahoo.com.br
Thu Jan 22 05:30:08 EST 2004


Or, more idiomatically,

a = range(8)
for b in a[:]:
   ...

:)

Aloysio


 --- Miki Tebeka <miki.tebeka at zoran.com> escreveu: >
Hello Rodrigo,
> > >>> a = range(8)
> > >>> for b in a:
> > 	if b == 4:
> > 		a.remove(b)
> > 	else:
> > 		print b
> try:
> a = range(8)
> for b in list(a): # Iterate over a shallow copy
>     if b == 4:
>         a.remove(b)
>     else:
>         print b
> 0
> 1
> 2
> 3
> 5
> 6
> 7
> 
> HTH.
> Miki
> -- 
> http://mail.python.org/mailman/listinfo/python-list 

______________________________________________________________________

Yahoo! GeoCities: a maneira mais fácil de criar seu web site grátis!
http://br.geocities.yahoo.com/




More information about the Python-list mailing list