dgadiraju
10/27/2017 - 11:52 AM

handling-exception-example.py

while True:
     try:
         x = int(input("Please enter a number: "))
         break
     except ValueError:
         print("Oops!  That was no valid number.  Try again...")
     except (RuntimeError, TypeError, NameError):
         pass