Skip to content

Instantly share code, notes, and snippets.

@andriisoldatenko
Last active November 20, 2018 05:42
Show Gist options
  • Save andriisoldatenko/cd6d10e2d9ff147a612838e8afa34e3d to your computer and use it in GitHub Desktop.
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
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