Remove all specific value from array

python

Solution

You can try:

`filter (lambda a: a != value_to_remove, my_array)`

Example:

>>> my_array = ["abc", "def", "xyz", "abc", "pop", "abc"]
>>> filter (lambda a: a != "abc", my_array)
['def', 'xyz', 'pop']

Problem

I have to remove all specific values from array (if any), so i write: ``` while value_to_remove in my_array: my_array.remove(value_to_remove) ``` Is there more pythonic way to do this, by one command?

Original source

Related problems