##// END OF EJS Templates
Improve Python 3 compatibility in example notebooks
Thomas Kluyver -
Show More
@@ -153,9 +153,8 b''
153 "collapsed": false,
153 "collapsed": false,
154 "input": [
154 "input": [
155 "# Python 3 compat\n",
155 "# Python 3 compat\n",
156 "try:\n",
156 "import sys\n",
157 " raw_input\n",
157 "if sys.version_info[0] >= 3:\n",
158 "except NameError:\n",
159 " raw_input = input"
158 " raw_input = input"
160 ],
159 ],
161 "language": "python",
160 "language": "python",
@@ -157,7 +157,7 b''
157 " # transform the input to executable Python\n",
157 " # transform the input to executable Python\n",
158 " code = self.shell.input_transformer_manager.transform_cell(cell.input)\n",
158 " code = self.shell.input_transformer_manager.transform_cell(cell.input)\n",
159 " # run the code in themodule\n",
159 " # run the code in themodule\n",
160 " exec code in mod.__dict__\n",
160 " exec(code, mod.__dict__)\n",
161 " finally:\n",
161 " finally:\n",
162 " self.shell.user_ns = save_user_ns\n",
162 " self.shell.user_ns = save_user_ns\n",
163 " return mod\n"
163 " return mod\n"
General Comments 0
You need to be logged in to leave comments. Login now