Multiple ExceptionsCatching more than one exception type is easytry: statements ... except IOError,e: # Handle I/O error ... except MemoryError,e: # Handle out of memory error ... except (IndexError, KeyError), e: # Handle either an IndexError or a KeyError ... Ignoring an exceptiontry: statements except IOError: pass |
<<< | O'Reilly OSCON 2000, Introduction to Python, Slide 71 July 17, 2000, beazley@cs.uchicago.edu |
>>> |