Basics of Python Programming: A Quick Guide for Beginners

Exception Handling

Author(s): Krishna Kumar Mohbey* and Malika Acharya * .

Pp: 182-194 (13)

DOI: 10.2174/9789815179637123010010

* (Excluding Mailing and Handling)

Abstract

In this chapter, we introduce the concept of exception handling in Python. They are used to specify the alternate sequence of actions the program needs to jump to at the occurrence of the event. For example, if we want to print several pages from the printer and somewhere in the middle of the job the paper gets stuck in the printer. In such as situation we would want to jump to the function that aborts the printing and handles this situation by instant shut down of the printer. In such events comes the exception handling. When the program jumps to the exception handler part the current sequence of commands is abandoned and the commands given to the exception handler are executed. After the exception is tackled the programming returns to the point where the marker left. 

© 2024 Bentham Science Publishers | Privacy Policy