python exception h code example
Example 1: except as Exception:
>>> def catch():
... try:
... asd()
... except Exception as e:
... print e.message, e.args
...
>>> catch()
global name 'asd' is not defined ("global name 'asd' is not defined",)
Example 2: try except python
def sum_of(x, y):
try:
print(x + y)
except TypeError:
print("Invalid argument specified.")