DEV Community

Cover image for Some known Exceptions  (python3)

Posted on


Some known Exceptions (python3)


Different exceptions are raised for different reasons.
Common exceptions:
ImportError: an import fails;
IndexError: a list is indexed with an out-of-range number;
NameError: an unknown variable is used;
SyntaxError: the code can't be parsed properly;
TypeError: a function is called on a value of an inappropriate type;
ValueError: a function is called on a value of the correct type, but with an inappropriate value.

Top comments (1)

waylonwalker profile image
Waylon Walker

KeyError: attempting to access an item in a dictionary that does not exist