import timeimport signaldef stop( signalNumber, frame ): global keepRunning keepRunning -= 1 print "Ctrl-C pressed; keepRunning is", keepRunningkeepRunning = 3signal.signal( signal.SIGINT, stop )while keepRunning: print "Executing..." time.sleep( 1 )
Name (required)
email (will not be published) (required)
Website