Answers for "how to remove all instances of an element from a list in python"

0

pythonremove all instances from a list

l = [0, 1, 0, 0, 1, 0, 1, 1]
val = 0
 
try:
	while True:
    	l.remove(val)
except ValueError:
	pass
Posted by: Guest on May-29-2021

Code answers related to "how to remove all instances of an element from a list in python"

Python Answers by Framework

Browse Popular Code Answers by Language