Demonstrates handling exceptions : Exception Handle « Exception « Python






Demonstrates handling exceptions

Demonstrates handling exceptions
 

# try/except
try:
    num = float(raw_input("Enter a number: "))
except:
    print "Something went wrong!"


           
         
  








Related examples in the same category

1.Simple exception handling exampleSimple exception handling example
2.Catch exception in a functionCatch exception in a function
3.Handling Exceptions
4.handle multiple exceptionshandle multiple exceptions
5.Exception handlers handle Exceptions occur inside functions. Exception handlers handle Exceptions occur inside functions.