Here are some useful keyboard shortcuts for Python development, especially when using popular IDEs and text editors like PyCharm, VS Code, and Jupyter Notebook:
General Shortcuts
- Ctrl + N: Create a new file.
- Ctrl + O: Open an existing file.
- Ctrl + S: Save the current file.
- Ctrl + Shift + S: Save all files.
- Ctrl + P: Open the file search dialog.
Editing Shortcuts
- Ctrl + Z: Undo the last action.
- Ctrl + Y or Ctrl + Shift + Z: Redo the last undone action.
- Ctrl + C: Copy selected text.
- Ctrl + X: Cut selected text.
- Ctrl + V: Paste copied text.
- Ctrl + A: Select all text.
- Ctrl + D: Duplicate the current line or selection.
- Ctrl + /: Toggle comment on the selected line(s).
Navigation Shortcuts
- Ctrl + F: Find text in the current file.
- Ctrl + R: Replace text in the current file.
- Ctrl + G: Go to a specific line number.
- Ctrl + Arrow Keys: Navigate between words.
- Home / End: Move to the beginning or end of a line.
- Ctrl + Home / End: Move to the beginning or end of the document.
Code Execution (Jupyter Notebook)
- Shift + Enter: Run the current cell and move to the next cell.
- Ctrl + Enter: Run the current cell without moving.
- Alt + Enter: Run the current cell and insert a new cell below.
Code Formatting and Refactoring (PyCharm)
- Ctrl + Alt + L: Reformat the current file.
- Shift + F10: Run the current script.
- Shift + F9: Debug the current script.
- Ctrl + Shift + Alt + T: Refactor the selected code.
Debugging Shortcuts
- F5: Start debugging.
- F10: Step over the next line of code.
- F11: Step into a function call.
- Shift + F11: Step out of the current function.
IDE Specific Shortcuts
- VS Code:
- Ctrl + Shift + P: Open the command palette.
- Ctrl + B: Toggle the sidebar.
- PyCharm:
- Ctrl + Shift + A: Find actions by name.
- Ctrl + Shift + N: Navigate to a file.