You are on page 1of 3

Python KeyError Exceptions and How to Handle

Them
Rich Bibby 5 Lessons  10m
 basics python

Python’s KeyError exception is a common exception encountered by beginners. Knowing why a KeyError can be
raised and some solutions to prevent it from stopping your program are essential steps to improving as a Python
programmer.

By the end of this course, you’ll know:

What a Python KeyError usually means


Where else you might see a KeyError in the standard library
How to handle a KeyError when you see it
When to raise a Python KeyError in your code

0% Completed  Watch Now


Let’s Get Started!

Python KeyError Exceptions and How to Handle Them


5 Lessons  10m

 1. What a Python KeyError Usually Means (03:20)

 2. Where You Might See a Python KeyError in the Standard Library (01:23)
Help

3 When to Raise a Python KeyError in Your Code (00:39)


3. When to Raise a Python KeyError in Your Code (00:39)

 4. How to Handle a Python KeyError (03:57)

 5. Python KeyError Exceptions and How to Handle Them: Summary (01:03)

 Watch Now

Mark as Completed

About Rich Bibby

Rich is an avid Pythonista and a video instructor at Real Python. He is also a Network Engineer
using Python to automate the management of a large network infrastructure. He lives in Dubai
UAE, with his wife and daughter plus a Miniature Schnauzer.

» More about Rich

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who
worked on this tutorial are:

Dan Tappan Joanna

Chad Aldren Brad

Participant Comments

Chasp on Nov. 26, 2019

Succinct and helpful. Really like Rich’s style of explanation. Learned something new!

Dev on Nov. 28, 2019

Very easy to follow


Anonymous on Nov. 29, 2019

Thorough & covers all the use cases.

« Browse All Courses

© 2012–2019 Real Python ⋅ Privacy Policy

You might also like