In PyCharm, you can use the following method to comment in batches:
- Select the code block you want to comment, which can be multiple lines or a single line.
- Use the following shortcut keys to comment:
- Windows/Linux: Ctrl /
- macOS: Command /
After pressing the shortcut key, the selected code block will be commented out, starting with "#".
In addition, if you want to uncomment the commented code block, you can use the same shortcut key to execute it again.