Skip to main content
100%

[Print Jupyter/IPython All Cell’s Outputs] 让 Jupyter 的 cell 中所有表达式结果都显示出来 #python #jupyter

✓ Published0🌍 Public
SShawn91
Last edited Apr 8, 2019
Created on Apr 8, 2019

This example demonstrates how to configure a Jupyter notebook so that every expression in a cell displays its output, rather than only the final one. It sets the IPython option `InteractiveShell.ast_node_interactivity` to `"all"` within a Python script, causing the kernel to print results for each statement. The code uses the `IPython.core.interactiveshell` module and assigns the string value directly to the shell’s attribute. The behavior is shown immediately after execution, with no additional libraries or data sources involved.

AI-generated description

Similar vizzes