Python Comments


Comments in Python:

Python has commenting capability for the purpose of code documentation.
Comments start with a #, and Python will treat the rest of the line as a comment:

Example:

#This is a comment.
print("Start Python")

Comments do not execute it is ignored by python.


Multi Line Comments

Python does not really have a syntax for multi line comments.
To add a multi-line comment you could insert a # for each line: 

Or, not quite as intended, use a multi-line string.

Example:

"""
This is a comment
written in 
more than just one line

"
""

This will create a multi-line comment for you.

Post a Comment

0 Comments