Improve Python 3 compatibility in example notebooks

Thomas Kluyver 13 years ago
parent 96c1af0ce4
commit e5603e18ce

@ -153,9 +153,8 @@
"collapsed": false,
"input": [
"# Python 3 compat\n",
"try:\n",
" raw_input\n",
"except NameError:\n",
"import sys\n",
"if sys.version_info[0] >= 3:\n",
" raw_input = input"
],
"language": "python",

@ -157,7 +157,7 @@
" # transform the input to executable Python\n",
" code = self.shell.input_transformer_manager.transform_cell(cell.input)\n",
" # run the code in themodule\n",
" exec code in mod.__dict__\n",
" exec(code, mod.__dict__)\n",
" finally:\n",
" self.shell.user_ns = save_user_ns\n",
" return mod\n"

Loading…
Cancel
Save