You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
316 B
22 lines
316 B
10 years ago
|
# test exception matching against a tuple
|
||
|
|
||
|
try:
|
||
|
fail
|
||
|
except (Exception,):
|
||
|
print('except 1')
|
||
|
|
||
|
try:
|
||
|
fail
|
||
|
except (Exception, Exception):
|
||
|
print('except 2')
|
||
|
|
||
|
try:
|
||
|
fail
|
||
|
except (TypeError, NameError):
|
||
|
print('except 3')
|
||
|
|
||
|
try:
|
||
|
fail
|
||
|
except (TypeError, ValueError, Exception):
|
||
|
print('except 4')
|