dgadiraju
11/4/2017 - 2:44 PM

python-exceptions.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