Answers for "remove all instances of item from list python efficiently"

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 "remove all instances of item from list python efficiently"

Python Answers by Framework

Browse Popular Code Answers by Language