Python Exception

python interpreter program after detecting an error, the program execution terminates and reports an error type. When an exception if there is no treatment or captured, it will throw an exception.

Traceback backtracking (track, because the exception or error occurs often in layers of a function call in)

Each class of exceptions are Example

Built-in Exception class

dir(__builtins__)

Exception handling can be used to determine if, but inflexible, inefficient.

try - except statement

try:

    block

except Exception as err:

     block

 else:

     block

finally:

     block  // which always be called

 

Guess you like

Origin www.cnblogs.com/hanxiangmin/p/11285250.html