What is the shortcut key to comment multiple lines using PyCharm IDE?
Question:
In Corey Schafer’s Programming Terms: Mutable vs Immutable, at 3:06, he selected multiple lines and commented them out in PyCharm all in one action.
What is this action? Is it a built-in shortcut in PyCharm that I can use or configure myself?
Answers:
This is a setting you can change and define in "Settings".
The default is with Ctrl+/ for Windows, or Cmd+/ for Mac.
This heavily depends on where you’re writing your python code. If you’re writing it in Notepad, there won’t be a shortcut for commenting a line.
However, if you use an IDE, you will probably have such capability alongside the ability to change the shortcut.
Just search Google for keyboard shortcuts for your preferred IDE.
Is depends on you’re text editor , but probably all text editor use (ctrl + /) just highlight all the code you need to comments and use the shortcut , to know what shortcut using in you’re favorite text editor search in google : YourTextEditor shortcuts
If you use macbook build-in keyboard, this shortcut does not work. So you can assign new shortcut for this purpose by following steps;
1.Go keymap menu
PyCharm -> Preferences -> Keymap
2.Find "comment with line comment" then click pencil sign "add keyboard shortcut" then assign your custom shortcut (press your favorite keyboard combination)
Years later: on AZERTY keyboard, ‘/’ from syntax area (;.:/!§,?), AKA "slash" does not work!
You have to use the ‘/’ symbol from numbers area (division symbol).
In Corey Schafer’s Programming Terms: Mutable vs Immutable, at 3:06, he selected multiple lines and commented them out in PyCharm all in one action.
What is this action? Is it a built-in shortcut in PyCharm that I can use or configure myself?
This is a setting you can change and define in "Settings".
The default is with Ctrl+/ for Windows, or Cmd+/ for Mac.
This heavily depends on where you’re writing your python code. If you’re writing it in Notepad, there won’t be a shortcut for commenting a line.
However, if you use an IDE, you will probably have such capability alongside the ability to change the shortcut.
Just search Google for keyboard shortcuts for your preferred IDE.
Is depends on you’re text editor , but probably all text editor use (ctrl + /) just highlight all the code you need to comments and use the shortcut , to know what shortcut using in you’re favorite text editor search in google : YourTextEditor shortcuts
If you use macbook build-in keyboard, this shortcut does not work. So you can assign new shortcut for this purpose by following steps;
1.Go keymap menu
PyCharm -> Preferences -> Keymap
2.Find "comment with line comment" then click pencil sign "add keyboard shortcut" then assign your custom shortcut (press your favorite keyboard combination)
Years later: on AZERTY keyboard, ‘/’ from syntax area (;.:/!§,?), AKA "slash" does not work!
You have to use the ‘/’ symbol from numbers area (division symbol).