How to insert single line and multi line comments in Python?
Answers
Answered by
1
Using multiple single # line comments. You can use # in Python to comment a single line: # THIS IS A SINGLE LINE COMMENT. ...
Using triple-quoted string literals. Another way to add multiline comments is to use triple-quoted, multi-line strings
Answered by
0
Comments starts with a #, and Python will ignore them:
Example
#This is a comment
print("Hello, World!")
Multi Line Comments
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!")
Similar questions