Skip to content

Dear Internet Explorer user: Your browser is no longer supported

Please switch to a modern browser such as Microsoft Edge, Mozilla Firefox or Google Chrome to view this website's content.

Skip cells when running Jupyter Notebook scripts

There is a surprisingly simple way to turn off specific cells in Jupyter Notebook without having to manually comment-out chunks of code.

The simple solution is to place the cursor into the cell that you want to silence, then press Esc + r. The cell will then transform into “raw” (Raw NBConvert) format and be skipped-over when the entire script is run.

Cell #8 has been converted to “Raw” format and will be skipped-over when the Notebook runs.

To revert it back, press Esc + y to return it to “code” format for re-inclusion.

Cell #8 has been converted back to “Code” format and will be executed when the Notebook runs.

If you simply want to comment-out a single cell, you can highlight the text and press Ctrl + /. This can be toggled.

   

Comments

No comments have yet been submitted. Be the first!

Have Your Say

The following HTML is permitted:
<a href="" title=""> <b> <blockquote cite=""> <code> <em> <i> <q cite=""> <strike> <strong>

Comments will be published subject to the Editorial Policy.