error raise python code example
Example 1: exception pyton print
except Exception as e: print(e)
Example 2: python: raise error
class MyError(TypeError):
pass
raise MyError('An error happened')
except Exception as e: print(e)
class MyError(TypeError):
pass
raise MyError('An error happened')