- 2
How can we comment multiple lines of code in one go?
3 odpowiedzi
+ 7
Use triple quotes.
'''
This is a multi line comment
This is a multi line comment
'''
Or
"""
This is a multi line comment
This is a multi line comment
"""
Placement of these type of comments is important, as they may be recognized as docstrings.
https://dbader.org/blog/JUMP_LINK__&&__python__&&__JUMP_LINK-multiline-comment#:~:text=Unlike%20other%20programming%20languages%20Python,removed%20by%20the%20Python%20parser.
+ 6
If you are using VS code :
Select multiple lines of code and press CTRL + /
selected lines will be commented with #
Or
Create a docstring by using quotes 3 times:
"""
This
comment
spans
multiple
lines
"""
+ 1
I am pretty sure the Python tutorial covers this aspect