Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Handle CTRL+C in Python
#!/usr/bin/env python
import signal
import sys
def signal_handler(signal, frame):
signal.signal(signal.SIGINT, signal_handler)

This comment has been minimized.

Copy link

commented Mar 7, 2019

Thank you for having the simplest solution to handing ctrl+c. People out there complicate things so much! haha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.