Possible Duplicate:
Removing an element from a list based on a predicate
Supposing I have a list and i want to delete from it elements that respect a condition,, how can i implement this easier?
I tried with:
for i in range (len(list)):
if [condition]:
del(list[i]);
Obviously it does not work...the only solution in my mind is do to shifts to left to replace the element i want to delete and then to delete the last element.. Anyway is there a faster solution?