less than 1 minute read

Python does not really have a syntax for multi line comments. To add a multiline comment you could insert a # for each line.

Example:

#This is a comment
#written in
#more than just one line
print("Hello, World!")

# Output:
Hello, World!

Other way to do it is adding a multi-line string (triple quotes or three single quotes) in your code, and place your comment inside it, you can do it because python ignore string that are not assigned to a variable.

Example:

"""
This is a comment
written in
more than just one line
"""
print("Hello, World!")

# Output:
Hello, World!

References

Multiple lines comments

Shortcut to comment out multiple lines