MASIGNASUKAv102
6510051498749449419

50 useful Python shortcuts:

50 useful Python shortcuts:
Add Comments
Wednesday, April 26, 2023




Hello World!

50 useful Python shortcuts:

1. Ctrl + Enter: Run current cell in Jupyter Notebook.
2. Shift + Enter: Run current cell and move to the next one in Jupyter Notebook.
3. Esc: Go to command mode in Jupyter Notebook.
4. Enter: Go to edit mode in Jupyter Notebook.
5. Tab: Indent or code completion in Python.
6. Shift + Tab: Tooltip in Python.
7. Ctrl + /: Comment or uncomment a line in Python.
8. Ctrl + Shift + -: Split the current cell in Jupyter Notebook.
9. Ctrl + Shift + +: Merge selected cells in Jupyter Notebook.
10. Ctrl + Shift + P: Command palette in Jupyter Notebook.
11. Ctrl + Shift + L: Toggle line numbers in Jupyter Notebook.
12. Ctrl + Shift + C: Copy selected text in the terminal.
13. Ctrl + Shift + V: Paste text in the terminal.
14. Ctrl + D: Duplicate current line in Python.
15. Ctrl + F: Find text in Python.
16. Ctrl + G: Find next occurrence of text in Python.
17. Ctrl + Shift + F: Replace text in Python.
18. Ctrl + Shift + G: Replace next occurrence of text in Python.
19. Ctrl + Shift + E: Show/hide the file explorer in Jupyter Notebook.
20. Ctrl + Shift + I: Show/hide the inspector in Jupyter Notebook.
21. Ctrl + Shift + M: Show/hide markdown cells in Jupyter Notebook.
22. Ctrl + Shift + T: Create a new tab in the terminal.
23. Ctrl + Shift + N: Create a new notebook in Jupyter Notebook.
24. Ctrl + Shift + S: Save the notebook in Jupyter Notebook.
25. Ctrl + Shift + W: Close the current notebook in Jupyter Notebook.
26. Ctrl + Shift + O: Clear the output of the current cell in Jupyter Notebook.
27. Ctrl + Shift + H: Show/hide keyboard shortcuts in Jupyter Notebook.
28. Ctrl + Alt + P: Insert current date and time in Python.
29. Ctrl + Alt + I: Show the current IPython kernel information in Jupyter Notebook.
30. Ctrl + Alt + L: Clear the screen in the terminal.
31. `str.format()`: Formats a string by replacing placeholders with values.
32. `zip()`: Iterates over two or more lists in parallel.
33. `max()`: Returns the largest item in an iterable or the largest of two or more arguments.
34. `min()`: Returns the smallest item in an iterable or the smallest of two or more arguments.
35. `sorted()`: Returns a new sorted list from the items in an iterable.
36. `enumerate()`: Returns an iterator that generates tuples containing indices and corresponding values from an iterable.
37. `filter()`: Filters elements from an iterable based on a given function.
38. `map()`: Applies a function to each item in an iterable and returns a new iterable with the results.
39. `reduce()`: Applies a function to the items in an iterable in a cumulative way, and returns a single value.
40. `lambda`: Creates an anonymous function.
41. `*args`: Passes a variable number of non-keyworded arguments to a function.
42. `**kwargs`: Passes a variable number of keyword arguments to a function.
43. `try/except`: Catches and handles exceptions that occur during runtime.
44. `with`: Creates a context in which a file or network connection is open for a limited scope.
45. `@decorator`: Modifies the behavior of a function or class by wrapping it with another function.
46. `__name__`: Returns the name of the current function, class, or module.
47. `__init__()`: Initializes a newly created object.
48. `__str__()`: Returns a string representation of an object.
49. `__repr__()`: Returns a string representation of an object that can be used to recreate it.
50. `dir()`: Returns a list of attributes and methods of an object or module.