Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

remove all elements from list python by value

# if you want to remove all 2's from the list
x = [1,2,3,2,2,2,3,4]
new_x = list(filter(lambda a: a != 2, x))
# the output:
# [1, 3, 3, 4]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #elements #list #python
ADD COMMENT
Topic
Name
9+5 =