>>> a=["b","c","t","y","b","b","b","b"] >>> a=[i for i in a if i != 'b'] >>> a ['c', 't', 'y']
>>> a=["b","c","t","y","b","b","b","b"] >>> a = filter(lambda x: x != 'b', a) >>> a ['c', 't', 'y'] 2009/6/1 秦锋 <[email protected]> > > a = set(a) > a.discard("b") > a = list(a) > > On 6月1日, 下午8时48分, DiveIntoGAE <[email protected]> wrote: > > >>> a=["b","c","t","y","b","b","b","b"] > > >>> a > > > > ['b', 'c', 't', 'y', 'b', 'b', 'b', 'b']>>> for i in a: > > > > a.remove("b") # why can't i remove all the "b" from list a? > > > > >>> a > > > > ['c', 't', 'y', 'b'] # this is the result after the for cycle>>> > a.remove("b") > > >>> a > > > > ['c', 't', 'y'] # i need to remove the last "b" a second time > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
