- In Jupyter实验室 https://jupyterlab.readthedocs.io/en/latest/,给定以下代码单元格,如何将其拆分为多个单元格?
- 同样,给定以下单元格,如何将它们组合成单个单元格?
直接使用 JupyterLab(而不是在 IDE 中)工作时。
-
JupyterLab: splitCell https://jupyterlab.readthedocs.io/en/latest/api/functions/notebook.NotebookActions.splitCell.html
- Source https://github.com/jupyterlab/jupyterlab/blob/main/packages/notebook/src/actions.tsx#L155
- In order to split one cell into many cells:
- Place cursors where the split is desired, and then press and release ctrl + shift + -
- Multiple cursors may be placed, by holding ctrl, and clicking the location for the cursor.
-
JupyterLab: mergeCells https://jupyterlab.readthedocs.io/en/latest/api/functions/notebook.NotebookActions.mergeCells.html
- Source https://github.com/jupyterlab/jupyterlab/blob/main/packages/notebook/src/actions.tsx#L252
- In order to merge multiple cells, into one cell:
- Select the desired, consecutive cells, by holding shift, and clicking in the margin, where the
[ ]
is, which will highlight the selected cells.
- While still holding shift, press m, and then release both keys.
- The resulting merged cell, will have a space between the code from each cell, as does the first image in this answer.
- 这是预期的行为newModel.value.text = toMerge.join('\n\n'); https://github.com/jupyterlab/jupyterlab/blob/master/packages/notebook/src/actions.tsx#L226
资源
- JupyterLab 阅读文档 https://jupyterlab.readthedocs.io/en/latest/api/index.html
- 所有笔记本操作 https://jupyterlab.readthedocs.io/en/latest/api/modules/notebook.NotebookActions.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)