浏览代码

Update the example notebook for python 2 compat

Steven Silvester 8 年之前
父节点
当前提交
284f195748
共有 1 个文件被更改,包括 15 次插入8 次删除
  1. 15 8
      examples/notebook/test.ipynb

+ 15 - 8
examples/notebook/test.ipynb

@@ -34,11 +34,15 @@
    ],
    "source": [
     "import sys\n",
-    "print('hello world', flush=True)\n",
+    "sys.stdout.write('hello world\\n')\n",
+    "sys.stdout.flush()\n",
     "for i in range(3):\n",
-    "    print(i, flush=True)\n",
-    "print('output to stderr', file=sys.stderr, flush=True)\n",
-    "print('some more stdout text', flush=True)"
+    "    sys.stdout.write('%s\\n' % i)\n",
+    "    sys.stdout.flush()\n",
+    "sys.stderr.write('output to stderr\\n')\n",
+    "sys.stderr.flush()\n",
+    "sys.stdout.write('some more stdout text\\n')\n",
+    "sys.stdout.flush()"
    ]
   },
   {
@@ -145,14 +149,17 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {},
+   "metadata": {
+    "collapsed": true
+   },
    "outputs": [],
    "source": []
   }
  ],
  "metadata": {
+  "anaconda-cloud": {},
   "kernelspec": {
-   "display_name": "Python 3",
+   "display_name": "Python [default]",
    "language": "python",
    "name": "python3"
   },
@@ -166,9 +173,9 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.4.4"
+   "version": "3.5.2"
   }
  },
  "nbformat": 4,
- "nbformat_minor": 0
+ "nbformat_minor": 1
 }