I l@ve RuBoard Previous Section Next Section

Chapter 7. Exceptions

Our last chapter in this part of the book has to do with exceptions—events that can modify the flow of control through a program. In Python, exceptions can be both intercepted and triggered by our programs. They are processed by two new statements we'll study in this chapter:

try

Catches exceptions raised by Python or a program

raise

Triggers an exception manually

With a few exceptions (pun intended), we'll find that exception handling is simple in Python, because it's integrated into the language itself as another high-level tool.

I l@ve RuBoard Previous Section Next Section