The else Clauses : Try : Statement PYTHON TUTORIALS


PYTHON TUTORIALS » Statement » Try »

 

The else Clauses


try:
   v = intraw_input("Enter a value: "))
   print "We got some valid input!"
   x = 100 / v
except (KeyboardInterrupt):
   print "well, ok, if you don't really want to.."
except ZeroDivisionError:
   print "You can't divide by ZERO!"
except:
    print "Some other error happened here"
else:
    print "All went well, x = ", x



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Statement
» Try