[Python] Exception Handling

 

 Example 1:

the try : 
    NUM = the eval (INPUT ( " Please enter an integer: " ))
     Print (NUM ** 2 )
 the except :
     Print ( " is not an integer input " )

Example 2:

the try : 
    NUM = the eval (INPUT ( " Please enter an integer: " ))
     Print (NUM ** 2 )
 the except NameError:  
     Print ( " input is not an integer " )

Guess you like

Origin www.cnblogs.com/HGNET/p/12179523.html