How can I ignore the \"not in list\" error message if I call a.remove(x) when x is not present in list a?
a.remove(x)
x
a
This is my situation:
A good and thread-safe way to do this is to just try it and ignore the exception:
try: a.remove(10) except ValueError: pass # do nothing!