Jupyter Notebook: command for hide the output of a cell?

前端 未结 7 727
被撕碎了的回忆
被撕碎了的回忆 2021-02-03 17:30

In my notebook, I have a cell returning temp calculation results. It\'s a bit long, so after it is run, I want to hide it and when needed, to show it.

To do it manually,

7条回答
  •  广开言路
    2021-02-03 18:05

    You can add %%capture to the beginning of the cell.

    Jupyter provides a magic cell command called %%capture that allows you to capture all of to outputs from that cell.

    You can use it like this:

    %%capture test print('test')

    test.stdout => 'test\n'

    https://ipython.readthedocs.io/en/stable/interactive/magics.html

提交回复
热议问题