How to Create a Multiline Comment in Python 


               


How to Create a Multiline Comment in Python



Python


In this article, we show how to create a multiline comment in Python.

So a multiline comment is a comment that spans multiple lines (instead of just a single line).

When creating a single-line comment in Python, all you have to do is use the # (pound) sign and then everything that comes after this is the comment.

If you want to have a multiline comment in Python, then you use triple quotes to begin the comment, go however many lines you want to go, and then when you want to end it, you use closing triple quotes.

In the following line below, we show a comment that spans multiple lines.



So we've created 2 multiline comments above.

To create a multiline comment, we simply enclose the comment within triple quotation marks.

In between the 2 multiline comments, we have regular Python code that prints out a string.

And this is how to create a multiline comment in Python.


Related Resources

How to Randomly Select From or Shuffle a List in Python



HTML Comment Box is loading comments...