By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

Comments in Python

How to write comments in the Python programming language.

Created: 2012-02-25 18:04

To write comments in python, use the number # symbol. Also note that Python only supports single-line comments. It has been suggested to use triple quotation, but this will not really create a comment, and can take up additional memory.

Block comments in Python are created by using multiple #'s, one for each line in the comment. Below is an example of how to write comments in Python.

# My first multi-line comment,
# created by using multiple #'s.
# Python doesn't support true multi-liners..

string1 = 'I create python Apps'
# Another comment..
string2 = 'I create python Apps'