multi line comment

0 votes
I am beginner in python and I am not able to find how can we comment multiple lines. everywhere its either # or /*. This do works for single line but what about multiple lines?
Apr 18, 2018 in Python by ana1504.k
• 7,910 points
132 views

2 answers to this question.

0 votes

There is nothing called multi-line comment in python. Python by default does not contain special characters to make multi-line comments but still you can comment lines in the following way:

'''

This is a mutli-line comment.

it uses single quotes. 

there is another way you can do it

'''

or you can do it like this

"""

This is a mutli-line comment.

it uses double quotes. 

this is the other way you can do it

"""

When you use quotes, it is treated as a regular string but because it is not used in combination with printing statement or for any other task, it works like a multi-line comment

answered Jul 16, 2018 by Omkar
• 69,170 points
0 votes

‘’’

This is the way to

Enter multi line

Comment in Python

‘’’

"""

This is the way to

Enter multi line

Comment in Python

"""

answered Jul 16, 2018 by Priyaj
• 58,140 points

Related Questions In Python

0 votes
1 answer

Multiple line comment in Python

Try this ''' This is a multiline comment. I can ...READ MORE

answered May 31, 2018 in Python by charlie_brown
• 7,780 points
147 views
0 votes
1 answer

Multiple line comment in python

No, you can simply use triple codes ...READ MORE

answered Jun 28, 2018 in Python by v.liyyah
• 1,300 points
130 views
+1 vote
2 answers

Multiple line comment in Python

Try this ''' This is a multiline comment. ...READ MORE

answered Jul 31, 2018 in Python by Priyaj
• 58,140 points
236 views
0 votes
1 answer

Use conditional statements to handle multi-line conditions

You don't need to use 4 spaces ...READ MORE

answered Oct 15, 2018 in Python by charlie_brown
• 7,780 points
831 views
0 votes
1 answer

How to add a new line in Python?

You can use '\n' for a next ...READ MORE

answered May 2, 2018 in Python by aayushi
• 750 points
529 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,483 views
0 votes
1 answer
0 votes
1 answer

Multi-threading program in python

import threading import os def task1(): print("Task 1 assigned ...READ MORE

answered Feb 7, 2019 in Python by Omkar
• 69,170 points
175 views