Exceptions
Last updated
Last updated
try:
<try suite>
except <exception class> as <name>:
<except suite>
...>>> try:
x = 1/0
except ZeroDivisionError as e:
print('handling a', type(e))
x = 0
handling a <class 'ZeroDivisionError'>
>>> x
0