[Tutor] question about list

Liam Clarke cyresse at gmail.com
Fri Nov 12 03:26:14 CET 2004


Heh,

If you don't mind, could you explain how that works?

Especially the b=[element..] part.

Day by day, I learn that I have so much more to learn. Sheesh. 

Thanks, 

Liam Clarke
On Thu, 11 Nov 2004 19:59:09 -0500, Bill Mill <bill.mill at gmail.com> wrote:
> Lin,
> 
> b.sort()
> for i in b:
>     del a[i]
>     b = [element-1 for element in b]
> 
> Peace
> Bill Mill
> 
> 
> 
> 
> On Fri, 12 Nov 2004 07:24:50 +0800, Lin Jin <jinlin555 at msn.com> wrote:
> > > i am new to python.i have a question about list.if i have two list:
> > > a=[a,b,c,d,e,f,g]
> > > b=[1,2,4]
> > > and i want to remove the element of a using b,that is i want
> > a=[a,d,f,g],my
> > > code is like this:
> > > >>>for i in b:
> > > >>>    del a[i]
> > >
> > > but it is not working, it can't remove the correct items.what should i do
> >
> > > to make it correct?thx
> >
> > _________________________________________________________________
> > 免费下载 MSN Explorer:   http://explorer.msn.com/lccn/
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 


-- 
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.


More information about the Tutor mailing list