jim*_*iat 5 python pretty-print python-2.x python-2.7 jupyter-notebook
我想在Jupyter Notebook中漂亮地打印字典。
我正在使用以下内容:
import pprint
stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
stuff.insert(0, stuff[:])
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(stuff)
Run Code Online (Sandbox Code Playgroud)
但是,按Shift + Enter时,没有任何[out]单元格出现(即,我看不到漂亮的打印输出)
知道为什么会这样吗/为了看到漂亮的打印输出,我应该改变什么?
编辑:实际上这是一个python 2.7问题-它在3.x中正常工作。有没有人在python 2.7上试用过它,并且看到它起作用了?
小智 6
无论您开发什么都是正确的。唯一可能的原因是,Jupyter Notebook无法连接到服务器。如果您看到连接到内核/服务器(如工具栏中的下图所示),请尝试刷新连接或重新加载页面。
我使用了相同的代码,并且可以看到输出。检查下面的图像。
| 归档时间: |
|
| 查看次数: |
14286 次 |
| 最近记录: |