Created
November 29, 2016 02:29
-
-
Save hkwi/3154ee00faad7414c8b1c63f18ac38dd to your computer and use it in GitHub Desktop.
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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"hoge\n", | |
"hoge\n" | |
] | |
} | |
], | |
"source": [ | |
"import contextlib\n", | |
"\n", | |
"@contextlib.contextmanager\n", | |
"def hoge():\n", | |
" yield \"hoge\"\n", | |
"\n", | |
"with hoge() as s:\n", | |
" print(s)\n", | |
"\n", | |
"print(s)" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python [conda env:geo]", | |
"language": "python", | |
"name": "conda-env-geo-py" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.5.2" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment