Home  >  Article  >  Backend Development  >  How to add python comments

How to add python comments

藏色散人
藏色散人Original
2019-10-25 10:44:093770browse

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:

How to add python comments

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn