Wednesday, 28 November 2012

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





Share This!



No comments:

Post a Comment

Here We Write The Problems we face at different situations and Solutions to those problems.