I want to know if it's possible to catch a Control-C in python in the following manner:
if input != contr-c:
Consider reading this page about handling exceptions.. It should help.
As @abarnert has said, do
try: # DO THINGS except KeyboardInterrupt: # quit sys.exit()
You can also use the built in
exit() function, but as @erykson pointed out,
sys.exit is more reliable.