I want to remove a value from a list if it exists in the list (which it may not).
a = [1, 2, 3, 4] b = a.index(6) del a[b] print(a)
The abov
This example is fast and will delete all instances of a value from the list:
a = [1,2,3,1,2,3,4] while True: try: a.remove(3) except: break print a >>> [1, 2, 1, 2, 4]