Raising Exceptions : Exception Raise « Exception « Python






Raising Exceptions

Raising Exceptions


# The raise statement: force a specified exception to occur.

raise NameError, 'HiThere'

# The above could be written as 

raise NameError('HiThere') 


           
       








Related examples in the same category

1.Re-raise the exceptionRe-raise the exception