Thursday, November 29, 2012
2:21 PM

Solution: After Exception Catch in Python What will happen?

Exception Handling :
After Exception Catch Python will execute remaining code, See below Example 



#!/usr/bin/python3
# reading sitemap xml file
#

a=5

def diverror(a):
    a = a/0
    print(a)

try:
diverror(a)
except:
print("Division Error")
a = a+10
print(a)

Output:

Division Error
15





0 comments:

Post a Comment