How do I create multiline comments in Python?
In Python, you can create a multiline comment using triple quotes (either single or double) at the beginning and end of the comment. Here's an example of a multiline comment:
"""
This is a
multiline comment
print("this will not be printed")
"""
print("but this will be")
Watch a video course
Python - The Practical Guide
You can also use triple single quotes (''') to create a multiline comment, like this:
You can place a multiline comment before or after a statement or group of statements, or you can place it on its own line. You can use these to document your code and add additional information about a specific section of code which will help other developers understand what it does and why it exists.
You can also use single line comments with #
which will only comment out a single line and ignore the rest of the line.
# This is a single line comment
# print("Not to be printed")
print("Hello World") # This is also a single line comment