What is the shortcut key to comment multiple lines using PyCharm IDE?


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?

Asked By: Thirumalai vasan



This is a setting you can change and define in "Settings".

The default is with Ctrl+/ for Windows, or Cmd+/ for Mac.

Answered By: ShlomiF

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.

Answered By: Mart R

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

Answered By: Ma7

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)

Answered By: Tuncay Elvanağaç

Years later: on AZERTY keyboard, ‘/’ from syntax area (;.:/!§,?), AKA "slash" does not work!
You have to use the ‘/’ symbol from numbers area (division symbol).

Answered By: fgriset
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.