How to Write Multiline Comments in Python

You can write multiline comments in Python by following the given code. If you want to learn Python then I will highly recommend you to read This Book.

How to Write Multiline Comments in Python
How to Write Multiline Comments in Python

In Python, there is no proper syntax for multiline comments but you can do with these two methods.

Method 1

In this method, write # at starting for each line. There are different short-keys for different IDE’s to comment at once by selecting multiple lines. You can find it according to your IDE. It will save lot of time

#This is a
#Multiline Comment
#in Python
print("AiHints")

Method 2: This is a multiline string but without assigning it to any variable, we can use it as a multiline comment.

"""
AiHints is a website
for Artificial
Intelligenec
"""
print("AI")

People are also reading:

Best Python Books – Top 10 Python Books

Top 10 Computer Vision Books with Python

What is Computer Vision? Examples, Applications, Techniques

Leave a Comment

Your email address will not be published.