Last active
August 9, 2017 17:33
-
-
Save ralphsmith80/1c1e40fcadcb18dec498736efd163ff7 to your computer and use it in GitHub Desktop.
Get code after sys.exit()
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
import sys | |
def something(): | |
print("Kenny lives") | |
sys.exit() | |
print("Can you see me") | |
if __name__ == '__main__': | |
# only code here | |
def noop(): | |
def exit(): | |
pass | |
sys.exit = noop | |
something() | |
# output: | |
# Kenny lives | |
# Can you see me |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment