Created
October 31, 2018 04:55
-
-
Save NicHub/26172cf7b32a50170c3fdbe0e3913a81 to your computer and use it in GitHub Desktop.
Python silent exit on keyboard interrupt
This file contains 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
if __name__ == "__main__": | |
try: | |
main() | |
except(KeyboardInterrupt, SystemExit): | |
print("\b\b\033[K") | |
print("\nThat’s all folks") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment