How to (intermittently) skip certain cells when running IPython notebook?

后端 未结 7 2274
南笙
南笙 2020-12-04 15:41

I usually have to rerun (most parts of) a notebook when reopen it, in order to get access to previously defined variables and go on working.

However, sometimes I\'d

7条回答
  •  一生所求
    2020-12-04 16:15

    Here's a simple and universal solution without the need for workarounds: Simply type this as the top line of the cell to skip the cell:

    %%script echo skipping

    It's tested on Windows and Mac with recent Jupyter, and I think it should work on other Unix-like platforms as well because they also have an echo command. Some of the other proposed solutions are more platform-specific.

    Of course you can put what ever text you like instead of "skipping". When you execute the cell, it will merely print this text instead of executing the code in the cell.

提交回复
热议问题