l = [0, 1, 0, 0, 1, 0, 1, 1] val = 0 try: while True: l.remove(val) except ValueError: pass
myList = [2, 1, 3, 5, 1, 1, 1, 0] valueToBeRemoved = 1 result = filter(lambda val: val != valueToBeRemoved, myList) print(list(result))