在用JupyterNotebook的时候,发现python代码里有这样一行:
InteractiveShell.ast_node_interactivity = "all"
对应的导入的包为:
from IPython.core.interactiveshell import InteractiveShell
查了下该句的作用:
jupyter notebook的每个cell只会显示最后一个输出结果,除非用print。例如:

添加了InteractiveShell.ast_node_interactivity = "all"
则会显示全部结果,如图所示例:

网友评论