How can we comment multiple lines of code in one go? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

How can we comment multiple lines of code in one go?

22nd Oct 2020, 6:02 PM
Ghadah Ibrahim
Ghadah Ibrahim - avatar
3 Answers
+ 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.
22nd Oct 2020, 6:08 PM
ChaoticDawg
ChaoticDawg - avatar
+ 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 """
22nd Oct 2020, 6:07 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 1
I am pretty sure the Python tutorial covers this aspect
22nd Oct 2020, 8:05 PM
Alexander Thiem
Alexander Thiem - avatar