Created
          March 1, 2021 18:51 
        
      - 
      
- 
        Save nitheeshkm/43ab26c303b6ad20452c7036d33d2d02 to your computer and use it in GitHub Desktop. 
    Handle CTRL+C in Python
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/usr/bin/env python | |
| import signal | |
| import sys | |
| def signal_handler(signal, frame): | |
| sys.exit(0) | |
| signal.signal(signal.SIGINT, signal_handler) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment