nowpython jumps to your handler--the block under the except clause that names the exception raised--automatically when an exception is triggered while the try block is running the net effect is to wrap nested block of code in an error handler that intercepts the block' exceptions when working interactively like thisafter the except clause runswe wind up back at the python prompt in more realistic programtry statements not only catch exceptionsbut also recover from themdef catcher()tryfetcher( except indexerrorprint('got exception'print('continuing'catcher(got exception continuing this timeafter the exception is caught and handledthe program resumes execution after the entire try statement that caught it--which is why we get the "continuingmessage here we don' see the standard error messageand the program continues on its way normally notice that there' no way in python to go back to the code that triggered the exception (short of rerunning the code that reached that point all over againof courseonce you've caught the exceptioncontrol continues after the entire try that caught the exceptionnot after the statement that kicked it off in factpython clears the memory of any functions that were exited as result of the exceptionlike fetcher in our examplethey're not resumable the try both catches exceptionsand is where the program resumes presentation notethe interactive prompt' reappears in this part for some top-level try statementsbecause their code won' work if cut and pasted unless nested in function or class (the except and other lines must align with the tryand not have extra preceding spaces that are needed to illustrate their indentation structureto runsimply type or paste statements with prompts one line at time raising exceptions so farwe've been letting python raise exceptions for us by making mistakes (on purpose this time!)but our scripts can raise exceptions too--that isexceptions can be raised by python or by your programand can be caught or not to trigger an exception exceptionsthe short story