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