Chris Rebert wrote:
On Thu, Feb 26, 2009 at 3:05 AM, Clarendon <[email protected]> wrote:
...
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?There are several ways. I'd go with a list comprehension:
and for a couple other ways
while 'a' in L : L.remove('a')
L = filter('a'.__ne__,L)
--
http://mail.python.org/mailman/listinfo/python-list
