Chapter 4. Exception Handling

Oh my God, he's fallen off the edge of the cartoon.

This chapter's aim is to teach you how to handle exception situations and how to manage error messages. Certainly the next couple of pages will guide you through a fantastic "catch-all-errors" kind of programming experience.

Exception Handling

Exceptions are mostly used for error handling and event notification. They work by breaking the regular flow of a program and jumping to a special set of statements that handle the exception case. Python has many standard exceptions, which are exceptions already built into the language. Python also supports user-defined exceptions, which are exceptions created by users. The provided exceptions are almost no different from user-defined ...

Get Python Developer's Handbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.