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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.