usefulness
The biggest advantage of notebook is the perfect combination: code run + markdown document.
installation
Install anaconda, comes with notebook application
Open notebook
Personal development environment: windows + vscode Enter
at the command line:, jupyter notebook
you can open the notebook in the default browser.
Common shortcut keys
Command mode (command mode)
in Edit mode, press Esc to enter command mode
hot key | effect | hot key | effect |
---|---|---|---|
A | insert cell above | B | insert cell below |
D+D | delete cell | AND | to code |
ctrl+enter | run select cell | M | to markdown |
X | cut select cells | C | copy select cells |
V | paste cells below | WITH | undo cell deletion |
Edit mode (edit mode)
Click the cell area and press shift to enter the edit mode (markdown or code)
Note: If it is a code cell, click the code area to enter edit mode
hot key | effect | hot key | effect |
---|---|---|---|
Ctrl+Enter | Run the selected code block | Shift+Enter | Run the code block, select the following code block |
Alt + Enter | Run the selected code block and insert a new unit below | Tab | Code completion, indentation |
Plug-in installation
Install Jupyter Notebook extensions
conda install -c conda-forge jupyter_contrib_nbextensions
Note: Possible error: ModuleNotFoundError: No module named 'jupyter_contrib_core'
Solution:
Install jupyter_contrib_core: pip install jupyter_contrib_core
then install extensions:conda install -c conda-forge jupyter_contrib_nbextensions
Several useful plugins
- markdown directory
Table of Contents (2) - Display space variables
Variable Inspector - Hide code input, only show result
Hide input all
tips
1. Change the default directory when the notebook is opened
Everything searches the jupyter_notebook_config.py file; open the file, find c.NotebookApp.notebook_dir = 'E:\\major\\python'
this line, and modify the directory.