-4

I see others do this but have no clue how they did. As title, if I want to add # in front of multiple line of code so that these code wont run, like this

print A
print B
print C

Then I want them become

# print A
# print B
# print C    

What is the fastest way?

zondo
  • 19,901
  • 8
  • 44
  • 83
pill45
  • 599
  • 3
  • 8
  • 23

3 Answers3

1

In python multiline comments can be used as follows:

'''print A
print B
print C'''

There are no multi line comments in python, just make the code as multi line string to ignore its execution.

riteshtch
  • 8,629
  • 4
  • 25
  • 38
1

Thanks everyone for mentioning that this is a problem of text editor not the python program itself.

And this movement is call "Comment/Uncomment" a block of code.

I am using textwrangler, so it is "command (or ⌘ for mac)" + "/".

pill45
  • 599
  • 3
  • 8
  • 23
0

It depends on your editor. For example, with IDLE you can quickly comment out multiple lines by highlighting them and pressing Alt+3 and uncomment them with Alt+4, but I cannot say that it's the same for you.

Chritical
  • 43
  • 5