cell输出很多,jupyter假死,在循环中添加清理内容
import IPython.display as display
display.clear_output(wait=True)
# test
print('before')
display.clear_output(wait=True)
print('after')
源码:
Signature: display.clear_output(wait=False)
Docstring:
Clear the output of the current cell receiving output.
清理当前cell的输出
Parameters
----------
wait : bool [default: false]
Wait to clear the output until new output is available to replace it.
有新内容的出现再清理
File: ~/anaconda3/lib/python3.7/site-packages/IPython/core/display.py
Type: function