I have found that the menu Code | "Comment with Block comment" is always disabled.
How to fix it?
To comment a line of code, place the caret at the appropriate line and press Ctrl+/ . Press Ctrl+/ again on the same line to uncomment it. To move a line up or down, press Alt+Shift+Up or Alt+Shift+Down respectively.
Comment out multiple lines in Pycharm If we have to comment out multiple lines of code in Pycharm, we can select the lines to be commented out and then press ctrl+shift+/ . To uncomment the lines, we just have to select the lines and then again press ctrl+shift+/ .
Using #'s to Comment a Block of Code The most straight-forward way to comment out a block of code in Python is to use the # character. Any Python statement that begins with a hashtag will be treated as a comment by the compiler.
To comment code in Python, write the “#” (octothorpe) at every new code line. It tells the Python compiler to ignore its execution and go to the following line. Comments start with a #, and the Python compiler will ignore its execution. We commented on the code using the # sign in the above example.
Because in Python, there is no such thing as a block comment.
The """ stuff here """
is for documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With