???? i can`t understand it

Anand Pillai pythonguy at Hotpop.com
Wed Aug 13 05:57:07 EDT 2003


I would rather use slices.
Here are two ways of doing it.

>>>a=[1,2,3,4,5]
>>>for b in a[0:]       # Small typo here in prev post  
...    a.remove(b)

>>>print a
[]

Or I think a better way is (dont ask me why!)
>>>a=[1,2,3,4,5]
>>>for b in a[:]:
...    a.remove(b)

>>>print a
[]


-Anand


bokr at oz.net (Bengt Richter) wrote in message news:<bh0vr8$1oe$0 at 216.39.172.122>...
> On Fri, 8 Aug 2003 08:05:11 -0300, "Batista, Facundo" <FBatista at uniFON.com.ar> wrote:
> 
> >This message is in MIME format. Since your mail reader does not understand
> >this format, some or all of this message may not be legible.
> 
> If you could eliminate the HTML, it would improve reception on this end ;-)
> 
> Regards,
> Bengt Richter




More information about the Python-list mailing list