Jupyter Notebook basics and keyboard shortcuts tips for Python beginners.
Hello reader. In this post, I’ll show the most important Jupyter Notebook keyboard shortcuts I have been using for my projects.
What is Jupyter Notebook¶?
The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. You can try a notebook in your browser without any installation here.
My experience:
I started programming Python using Pycharm that is an integrated development environment explicitly built for Python programming. I think if you are developing a big and complex program its probably the best choice. But if you are learning Python, exploring data, and building report showing step by step the code and the results a Jupyter Notebook might be the best option. One nice aspect of Jupyter is that its easy to install, easy to use, you can separate your code in several cells (“chunks of code”) and run them separately ending up with several results displayed in the notebook.
Basic notebook information:
Cell:
A notebook cell is where you write your code, it also will have the output attached to it once you have run the code.
Command Mode vs Edit Mode:
In a Jupyter notebook, there are two ways of accessing keyboard shortcuts command mode and edit mode. Command mode: has more to do with the cells (inserting new cells, deleting, copy and so on). Edit mode: is accessed when you want to write inside a cell, in edit mode, you can write and edit the code and finally run it.
Keyboard shortcuts for Windows users:
Command Mode:
1. Insert new cell above → a
2. Insert new cell below → b
3. Open edit mode selection in selected cell → Enter
4. Select multiple cells → Shift + down/up
5. Run selected cells → Shift + Enter
6. Merge selected cell → Shift + M
7. Cut selected cell → x
8. Past cell → v
9. Change cell type to markdown → m
10. Change cell to code type → c
Edit Mode:
- Run cell → Shift + Enter
2. Run cell and create new cell below → Alt + Enter
3. Comment code (May change depending on keyboard config) → Ctrl+ /
4. Move to Command Mode → Esc
5. Undo → Ctr + z
6. Redo → Ctr + y
7. Cut selected line or selected text → Ctrl + x
8. Paste → Ctrl+ v
9. Dent → Tab
10. Indents → Shift + Tab
Thanks for reading, hope this was helpful.