Skip to content

Instantly share code, notes, and snippets.

@saml
Created March 19, 2018 20:59
Show Gist options
  • Select an option

  • Save saml/97fc6a2f918e223522d376b73f443141 to your computer and use it in GitHub Desktop.

Select an option

Save saml/97fc6a2f918e223522d376b73f443141 to your computer and use it in GitHub Desktop.
def myfunc():
print('in my func')
with open('testhelper.py', 'r') as f:
yield f
with myfunc() as f:
for line in f:
print(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment