how to make an error message in python code example
Example 1: raise python
# Raise is used to cause an error
raise(Exception("Put whatever you want here!"))
raise(TypeError)
Example 2: 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 3: python exception
try:
# code block
except ValueError as ve:
print(ve)