On Feb 26, 3:05 am, Clarendon <jine...@hotmail.com> wrote: > Hi. This must be a simple command but I just can't find it in the > Phthon manual. How do I delete all items with a certain condition from > a list? For instance: > > L=['a', 'b', 'c', 'a'] > > I want to delete all 'a's from the list. > But if L.remove('a') only deletes the first 'a'. > > How do you delete all 'a's? > I would really appreciate your help. > > Thanks.
while 'a' in L: L.remove('a') not the most efficient but it works -- http://mail.python.org/mailman/listinfo/python-list