
Python comment: How to write comments in Python
In Python, a line starting with #
is regarded as a comment.
a = 1
b = 2
print(a)
# print(b)
In the above code, print(b)
is a comment and not skipped in processing.
Or the paragraph between '''
is a comment.
a = 1
b = 2
print(a)
'''
This paragraph is a comment.
print(b)
'''
So Python comment has 2 types: line and paragraph.
Most programming editors like PyCharm color a line or paragraph comment differently.
Comments
Powered by Markdown