PyCharm 4.0.0 Web Help

In this section:

Basics

You can comment or uncomment the current line or selected block of source code.

Commenting feature extends to all supported file types. For the custom file types, you can define line and block comments characters, as described in the section Creating and Registering File Types.

Commenting and uncommenting lines of code

Do one of the following

  • On the main menu, choose Code | Comment with Line Comment.
  • Press Ctrl+Slash or Ctrl+NumPad /Ctrl+Slash or Ctrl+NumPad /Ctrl+Slash or Ctrl+NumPad /Ctrl+Slash or Ctrl+NumPad /Alt+SemicolonCtrl+Slash, Ctrl+NumPad / or Ctrl+ColonCtrl+Slash or Ctrl+Shift+CCtrl+Slash or Ctrl+NumPad /⌘ Slash or ⌘ NumPad /⌘ Slash or ⌘ NumPad /⌘ Slash or ⌘ NumPad /.
Commenting and uncommenting blocks of code

To add or remove a block comment, do one of the following:

  1. On the main menu, choose Code | Comment with Block Comment.
  2. Press Ctrl+Shift+Slash or Ctrl+Shift+NumPad /Ctrl+Shift+Slash or Ctrl+Shift+NumPad /Ctrl+Shift+Slash or Ctrl+Shift+NumPad /Ctrl+Shift+Slash or Ctrl+Shift+NumPad /Ctrl+Shift+Slash or Ctrl+Shift+NumPad /Ctrl+Shift+Slash, Ctrl+Shift+NumPad / or Ctrl+Shift+ColonCtrl+Shift+Slash or Ctrl+Shift+NumPad /Ctrl+Shift+SlashAlt ⌘ Slash, Alt ⌘ NumPad /, Control Shift Slash, Control Shift NumPad /, Shift ⌘ Slash or Shift ⌘ NumPad /Control Shift Slash, Control Shift NumPad /, Shift ⌘ Slash or Shift ⌘ NumPad /Control Shift Slash.

Note

Block comments do not apply to Python scripts.

See Also

Procedures:

Web Resources: