Ravindra BagaleCourses & study guides मराठी Track your progress

Python Errors and Exceptions: How to Use try, except, else and finally

Ravindra Bagale's Tip — Chala mitrano

Errors are not your enemy. They are Python telling you exactly what went wrong. Today we learn to read error messages and to handle bad data without crashing.

What you will learn in this chapter

  • How to read a Python error message
  • Common error types in data work
  • try and except
  • Catching specific errors
  • else and finally
  • Raising your own errors for bad data

Practice data

All names, shops, banks, hospitals and amounts in this chapter are made up for learning. They are not real people or real company numbers.

Concepts in this chapter

  1. P8.1How to Read a Python Error Message (Traceback)
  2. P8.2Common Python Errors in Data Work and Their Fixes
  3. P8.3How to Use try and except in Python
  4. P8.4Python try except else finally Explained
  5. P8.5How to Raise an Error in Python for Bad Data