I know this works,
try:
# do something that may fail
except:
# do this if ANYTHING goes wrong
I know, even this works:
try:
# do something that may fail
except IDontLikeYouException:
# say please
except YouAreTooShortException:
# stand on a laddertry:
# do something that may fail
except IDontLikeYouException:
# say please
except YouAreTooShortException:
# stand on a ladder
But If I try to do the same thing inside two different exceptions, Like this :
try:
# do something that may fail
except IDontLikeYouException:
# say please
except YouAreBeingMeanException:
# say please
I just want to know whether I can do this :
try:
# do something that may fail
except IDontLikeYouException, YouAreBeingMeanException:
# say please
Since it matches the syntax, it won't work for:
try:
# do something that may fail
except Exception, e:
# say please
Is there any way, so that I can catch two distinct exceptions?