Nested try and catch : Try « Language Basics « Python






Nested try and catch

Nested try and catch

try:
    try: 1/0
    except: 
       print "caught an exception"
except ZeroDivisionError:
    print "caught divide-by-0 attempt"

           
       








Related examples in the same category

1.try/except/elsetry/except/else