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
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