Except two exceptions : Try : Statement PYTHON TUTORIALS


PYTHON TUTORIALS » Statement » Try »

 

Except two exceptions


try:
   v = intraw_input("Enter a value: "))
   print "We got some valid input!"
   x = 100 / v
except (ValueError, KeyboardInterrupt):
   print "Invalid input, please enter a value"
except ZeroDivisionError:
   print "You can't divide by ZERO!"



Leave a Comment / Note


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


PYTHON TUTORIALS

 Navioo Statement
» Try