Mega Code Archive

 
Categories / Python Tutorial / Statement
 

Except two exceptions

try:    v = int( raw_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!"