DEV Community

Cover image for Some known Exceptions  (python3)
francnstein
francnstein

Posted on

1 1

Some known Exceptions (python3)

Exceptions

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)

Collapse
 
waylonwalker profile image
Waylon Walker

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

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay