0%

// in Python

How to comment in Python?😒

Comments in Python have single-line comments and multi-line comments.


🔸Single-line comments

1
2
# This is a comment
print("Hello, World!")

🔹Multi-line comments
single quotes '''

1
2
3
4
5
6
'''
This is a multi-line comment with three single quotes
This is a multi-line comment with three single quotes
This is a multi-line comment with three single quotes
'''
print("Hello, World!")

double quotes """

1
2
3
4
5
6
"""
This is a multi-line comment with three double quotes
This is a multi-line comment with three double quotes
This is a multi-line comment with three double quotes
"""
print("Hello, World!")

  • Single-line comments in Python start with #, Multi-line comments enclose comments with three single quotes ''' or three double quotes """.