Python Common Exceptions List

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.