Skip to content

Instantly share code, notes, and snippets.

@hkwi
Created November 29, 2016 02:29
Show Gist options
  • Save hkwi/3154ee00faad7414c8b1c63f18ac38dd to your computer and use it in GitHub Desktop.
Save hkwi/3154ee00faad7414c8b1c63f18ac38dd to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"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