Common python exceptions
| Abnormal |
Describe |
| Assertionerror |
ASSERT (assertion) statement failed |
| Attributeerror |
An attempt was made to access a property that an object does not have, such as foo.x, but Foo does not have an X attribute. |
| IOError |
The input/output exception is basically unable to open the file. |
| Importerror |
Unable to introduce modules or packages, basically a path problem |
| Indentationerror |
Syntax error, code not aligned correctly |
| Indexerror |
The subscript index is out of sequence boundaries, such as when X has only three elements, but tries to access X[5] |
| Keyerror |
Attempting to access a key that does not exist in the dictionary |
| Kerboardinterrupt |
Ctrl + C is pressed |
| Nameerror |
Use a variable that has not been assigned to an object |
| SyntaxError |
Python code is illegal, code cannot be interpreted |
| TypeError |
Incoming object type does not match the requirements |
| Unboundlocalerror |
Attempting to access a local variable that has not yet been set is basically due to another global variable with the same name, causing you to think that you are accessing it |
| ValueError |
Pass in a value that is not expected by the caller, even if the value is of the correct type |
Python official exception list: Https://docs.python.org/3/library/exceptions.html#exception-hierarchy
This article is from the "Professor" blog, please be sure to keep this source http://professor.blog.51cto.com/996189/1739694
Python Common Exceptions List