How to create multiline comment in Python ?
Python doesn't officially support multiline comments. But there are mainly 2 ways to make multiline comment in Python.
- Use multiple single line comments. Like this
# this is line 1 of comment # this is line 2 of comment # this is line 3 of comment
- Use triple quoted strings. Like this
''' This is a multiline comment. This can go to multiple lines. '''
When triple quoted strings are not a docstring they are ignored. docstring are the first thing in a class / function / module.
Just keep in mind to properly indent the triple quotes. triple quoted comments are however not encouraged by python. It's recommended to use multiple single line comments.