Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created April 25, 2024 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mypy-play/d5caacc6bd29a1c3b991fe9b77f73158 to your computer and use it in GitHub Desktop.
Save mypy-play/d5caacc6bd29a1c3b991fe9b77f73158 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
from contextlib import ExitStack
filenames = ("test", "test2")
with ExitStack() as stack:
for x in filenames:
stack.enter_context(open(x))
y = 2
print(y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment