program structure and control flow when catching all exceptionsyou should take care to report accurate error information to the user for examplein the previous codean error message and the associated exception value is being logged if you don' include any information about the exception valueit can make it very difficult to debug code that is failing for reasons that you don' expect all exceptions can be caught using except with no exception type as followstrydo something excepterror_log write('an error occurred\ 'correct use of this form of except is lot trickier than it looks and should probably be avoided for instancethis code would also catch keyboard interrupts and requests for program exit--things that you may not want to catch the try statement also supports an else clausewhich must follow the last except clause this code is executed if the code in the try block doesn' raise an exception here' an exampletryf open('foo'' 'except ioerror as eerror_log write('unable to open foo % \neelsedata read( close(the finally statement defines cleanup action for code contained in try block here' an examplef open('foo',' 'trydo some stuff finallyf close(file closed regardless of what happened the finally clause isn' used to catch errors ratherit' used to provide code that must always be executedregardless of whether an error occurs if no exception is raisedthe code in the finally clause is executed immediately after the code in the try block if an exception occurscontrol is first passed to the first statement of the finally clause after this code has executedthe exception is re-raised to be caught by another exception handler built-in exceptions python defines the built-in exceptions listed in table lib fl ff