I want to catch and handle a specific Exception and I want all others to be raised.
The exception I want to catch is like:
Exception("exception want to catch")
The code I tried below doesn't work. In the first code I want the exception to be raise;
try:
raise Exception("exception don't want to catch")
except Exception("exception want to catch"):
pass
But I wouldn't want an exception raise for this code:
try:
raise Exception('exception want to catch')
except Exception('exception want to catch'):
pass
ValueErrorvs.TypeError) or the same type of error with a different message? Did you write the code that raises the error, too?