Home > Article > Backend Development > How to add python comments
How to add python comments?
1. Python single-line comment symbol (#)
The pound sign (#) is often used as a single-line comment symbol. When # is used in the code, any data to the right of it will Ignored and treated as a comment. The content to the right of
print 1 #输出1
# will not be output during execution.
2. Batch and multi-line comment symbols
In python, there will also be comments with many lines. In this case, batch multi-line comment symbols are needed. Multi-line comments are enclosed in triple quotes ''' ''', for example:
Some people may say that this is not confused with multi-line strings. But I see many programmers using it this way, so just pay attention to the distinction when using it.
Recommended: "python tutorial"
The above is the detailed content of How to add python comments. For more information, please follow other related articles on the PHP Chinese website!