jupyter notebook | 不用print即可输出多个变量
缘由
有时候在jupyter notebook上想监测某些变量的时候希望在一个cell里输出多个,但是又不懒得不断print,但是这样只会输出最后一个的值,比如:
a,b = 1,2
a
b
2
解决方法
单个文件
如果希望不需要print即可同时输出a b的值,在jupyter notebook开头运行这两行代码:
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



