How To Run Custom Code Upon Hitting Ctrl+C/CMD+C In Python ?
May 30, 2022
Q: Wonder if it is possible to run custom code upon hitting ctrl+c
in Python script ?
A: Sure, just use KeyboardInterrupt
exception class which and the code inside the except
block will be executing