ch07
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# exceptions/multiple.py
|
||||
values = (1, 2) # try (1, 0) and ('one', 2)
|
||||
|
||||
try:
|
||||
q, r = divmod(*values)
|
||||
except (ZeroDivisionError, TypeError) as e:
|
||||
print(type(e), e)
|
||||
|
||||
|
||||
try:
|
||||
q, r = divmod(*values)
|
||||
except ZeroDivisionError:
|
||||
print("You tried to divide by zero!")
|
||||
except TypeError as e:
|
||||
print(e)
|
||||
Reference in New Issue
Block a user