Indentation width in jupyter notebook

Asked 2 years ago, Updated 2 years ago, 73 views

In jypyter notebook, I didn't set it specifically, but the indentation width is 2.
I'd like to change the indentation to 4 spaces, what should I do?

python jupyter-notebook

2022-09-30 17:48

1 Answers

According to the official document, you can change the indentation width by executing the following code in your browser's Javascript console:

varcell=Jupyter.notebook.get_selected_cell();
varconfig =cell.config;
var patch = {
      CodeCell: {
        cm_config: {indentUnit:4}
      }
    }
config.update (patch)


2022-09-30 17:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.