#! /usr/bin/python
import signal
import sys
def signal_handler(signal, frame):
print 'You pressed Ctrl+C!'
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
print 'Press Ctrl+C'
while 1:
continue
(c) http://stackoverflow.com/questions/1112343/how-do-i-capture-sigint-in-python
No comments :
Post a Comment
Note: only a member of this blog may post a comment.