Python error type

Source: Internet
Author: User

when you run or write a program that often encounters an error exception, Python will give you an error prompt class name to tell what the problem is (Python is an object-oriented language, so the exception that the program throws is also a class). A good understanding of the meaning of these error-aware class names can help you find the problem in the quickest time possible, and solving the procedural problems is very helpful.

collected some of Python's most important built-in exception class names, and made a brief introduction:
Attributeerror: Property error, attribute reference and assignment failure when property error is raised
nameerror: The variable name you are trying to access does not exist
syntaxerror: syntax error, code form error
Exception: The base class for all exceptions, because all Python exception classes are members of the base class Exception, and exceptions are inherited from the base class Exception and are defined in the Exceptions module.
IOError: It is generally common to throw IOError errors when opening files that do not exist, or to solve output input errors
keyerror: A keyword error that is thrown when a keyword (key) that does not exist in the map is used
indexerror: Index error, index not present, constant index out of sequence range, what is index
TypeError: Type error, built-in operation, or function should throw a type error on an object of the wrong type
zerodivisonerror: The divisor is 0, and the second argument is 0 o'clock when it is used in a division operation, the error is raised
valueerror: A value error, the argument type passed to the object is not correct, like a parameter that passed the string data type to the Int () function.

Python error type

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.