Last Updated : 12 Jul, 2025
Comments in Python are the lines in the code that are ignored by the interpreter during the execution of the program.
# I am single line comment
""" Multi-line comment used
print("Python Comments") """
Comments in Python
In Python, single line comments starts with hashtag symbol #.
Python
# sample comment
name = "geeksforgeeks"
print(name)
Multi-Line Comments
Python does not provide the option for multiline comments. However, there are different ways through which we can write multiline comments.
Multiline comments using multiple hashtags (#)
We can multiple hashtags (#) to write multiline comments in Python. Each and every line will be considered as a single-line comment.
Python
# Python program to demonstrate
# multiline comments
print("Multiline comments")
Also Check: Interesting Fact about Python Multi-line Comments
Using String Literals as CommentPython ignores the string literals that are not assigned to a variable. So, we can use these string literals as Python Comments.
Python
'Single-line comments using string literals'
""" Python program to demonstrate
multiline comments"""
print("Multiline comments")
Best Practice to Write Comments
These are some of the tips you can follow, to make your comments effective are:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4