[Tutor] question about list

Bill Mill bill.mill at gmail.com
Fri Nov 12 01:59:09 CET 2004


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
>


More information about the Tutor mailing list