1# Raise is used to cause an error
2raise(Exception("Put whatever you want here!"))
3raise(TypeError)
1>>> try:
2... raise Exception('spam', 'eggs')
3... except Exception as inst:
4... print(type(inst)) # the exception instance
5... print(inst.args) # arguments stored in .args
6... print(inst) # __str__ allows args to be printed directly,
7... # but may be overridden in exception subclasses
8... x, y = inst.args # unpack args
9... print('x =', x)
10... print('y =', y)
11...
12<class 'Exception'>
13('spam', 'eggs')
14('spam', 'eggs')
15x = spam
16y = eggs