Comment out multiple lines in Visio Studio Code

Visio Studio Code is great for working with Python scripts. A quick way to comment out lines of instructions is to use Ctrl + Alt + Down Arrow.

Before:

print(“line1”)

print(“line2”)

print(“line3”)

Place cursor at beginning of the first line, in this case the line with “print(“line1″)”. Next press Ctrl + Alt + Down Arrow and release when the last line is reached i.e. “print(“line3″)”. Type the “#” character and all lines will be commented out.

After:

#print(“line1”)

#print(“line2”)

#print(“line3”)

Similarly, to remove the “#” symbol use the same method to select the lines but select delete key to remove the hash character (in Python this will change the print statements back to code again).  

Leave a comment