Close

Python Comments

[Last Updated: Feb 1, 2022]

Single line comment

In Python single line comment can be added by using # :

scripts/python-comments.py

# greeting script
print("Hi there!")  # printing

Output


Output
Hi there!

Multiline comments

Content enclosed by triple quotes can be used as multiline comments

"""
This is my long comment
Last line of comment
"""
print("Hi there!")

Output


Output
Hi there!

Example Project

Dependencies and Technologies Used:

  • Python 3.10.2
Using Comments in Python Select All Download
  • python-comments
    • scripts
      • python-comments.py

    See Also

    Join