Single Line Comment#
A single line comment starts with # and continues until the end of the line.
# Everything on this line is commented.
print("Hello, World!")You can also write it inline, to the right of your code:
print("Hello, World!") # Everything to the right is commented.Multi-Line Comments#
Python does not have a dedicated block comment syntax. Instead, you write multiple single line comments:
# This is a comment
# that spans multiple
# lines
print("Hello, World!")