Mega Code Archive

 
Categories / Python Tutorial / Statement
 

Catch Keyboard interrupt exception

try:     name = raw_input("Enter your name: ")     print "You entered: " + name except KeyboardInterrupt:     print "You hit control-c"