python shell怎么清空_如何从Linux终端的所有单元中清除IPython Notebook的输出?

I have a problem when the output from a notebook is really long and it's saved into the notebook, any time I want to open this particular notebook again the browser crashes and can't display correctly.

To fix this I have to open it with a text editor and delete all output from that cell causing the problem.

I wonder if there is a way to clean all output from the notebook so one can open it again without problem. I want to delete all output since deleting a specific one seems more troublesome.

解决方案

--ClearOutputPreprocessor.enabled=True

There is now a built-in command line option to do it:

jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace Notebook.ipynb

Or to another file called NotebookNoOut.ipynb:

jupyter nbconvert --ClearOutputPreprocessor.enabled=True \

--to notebook --output=NotebookNoOut Notebook.ipynb

jupyter nbconvert --help also documents a --clear-output option, but for some reason it did not work.

Tested in Jupyter 4.4.0, notebook==5.7.6.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值