An exception is the wrong signal occurs when the program runs
Exception Handling: to run the program error message
Resolve exceptions: Use if
Five, python all of the standard exception classes:
Exception Name Description
Base class for all exceptions BaseException
SystemExit interpreter requested to exit
KeyboardInterrupt User Interrupt Executing (usually enter ^ C)
General Error Exception base class
StopIteration iterator no more value
To notify the exit abnormal GeneratorExit Generator (generator) occurs
SystemExitPython interpreter requested to exit
All standard exceptions built StandardError base class
All numerical errors ArithmeticError base class
FloatingPointError floating point calculation error
Exceeds the maximum limit value calculation OverflowError
ZeroDivisionError addition (or modulus) of zero (all data types)
AssertionError assertion failure
AttributeError object does not have this property
EOFError no built-in input reaches EOF marker
EnvironmentError base class operating system error
IOError input / output operations to fail
OSError operating system error
WindowsError system call fails
ImportError import module / object failed
KeyboardInterrupt User Interrupt Executing (usually enter ^ C)
LookupError invalid base class data queries
IndexError there is no sequence of the index (index)
KeyError map does not have this key
MemoryError memory overflow error (for Python interpreter is not fatal)
NameError not declare / initialize objects (no attributes)
UnboundLocalError access to the local variables uninitialized
ReferenceError weak reference object (Weak reference) have been trying to access a garbage collection of
RuntimeError general run-time error
Methods NotImplementedError unfulfilled
SyntaxErrorPython syntax error
IndentationError indentation errors
TabErrorTab and spaces mix
SystemError general explanation of system error
TypeError invalid type of operation
Invalid parameter passed ValueError
UnicodeErrorUnicode related errors
Error when decoding UnicodeDecodeErrorUnicode
When coding errors UnicodeEncodeErrorUnicode
UnicodeTranslateErrorUnicode conversion error
Warning The base class
DeprecationWarning warnings about deprecated features
FutureWarning warnings about the future structure of the semantics have changed
OverflowWarning old warning about automatically promoted to a long integer (long) of
PendingDeprecationWarning on features will be abandoned warning
RuntimeWarning suspicious behavior (runtime behavior) run-time warning
SyntaxWarning suspicious warning grammar
UserWarning user code generated warning