Last active
November 20, 2018 05:42
-
-
Save andriisoldatenko/cd6d10e2d9ff147a612838e8afa34e3d to your computer and use it in GitHub Desktop.
This function helps you do not see errors during upload solutions, because you forget to switch back to sys.stdin and also you can easily debug your code with ipdb or another python debuggers
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
def fopen(filename, default=sys.stdin): | |
""" | |
This function helps you do not see errors during upload solutions | |
because you forget to switch back to sys.stdin and also you can easily | |
debug your code with ipdb or another python debuggers | |
""" | |
try: | |
f = open(filename) | |
except FileNotFoundError: | |
f = default | |
return f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment