Shortcut to comment out multiple lines with Python Tools for Visual Studio
Question:
What is the shortcut to comment out multiple lines with Python Tools for Visual Studio?
Answers:
On python the only way is """ ... """
, practically just a string.
CTRL+K then CTRL+C adds the #
in VS for selected lines.
CTRL+K then CTRL+U removes the #
in VS for selected lines.
All you need to do is select the block of code and type ctrl+1.
You should be all set!
To make the comment of a block, it is a sequence of keys: Ctrl-K + Ctrl+C and to un-comment Ctrl-K + Ctrl-U.
Here are some other very useful keys for Python:
If you want to comment out any line in python (when using visual code) then the shortcut is: Ctrl + / (control button plus forward slash)
The easiest way to achieve this is to highlight all the previous written code you wish to comment out, then control KC. You will not experience any bugs or altered code during the process. Sometimes Other methods just
don’t work.
To comment or uncomment
Ctrl + /
What is the shortcut to comment out multiple lines with Python Tools for Visual Studio?
On python the only way is """ ... """
, practically just a string.
CTRL+K then CTRL+C adds the #
in VS for selected lines.
CTRL+K then CTRL+U removes the #
in VS for selected lines.
All you need to do is select the block of code and type ctrl+1.
You should be all set!
To make the comment of a block, it is a sequence of keys: Ctrl-K + Ctrl+C and to un-comment Ctrl-K + Ctrl-U.
Here are some other very useful keys for Python:
If you want to comment out any line in python (when using visual code) then the shortcut is: Ctrl + / (control button plus forward slash)
The easiest way to achieve this is to highlight all the previous written code you wish to comment out, then control KC. You will not experience any bugs or altered code during the process. Sometimes Other methods just
don’t work.
To comment or uncomment
Ctrl + /