There are many kinds of comments in python, including single-line comments, multi-line comments, batch comments, and Chinese comments are also commonly used. Python annotations also have their own specifications. Comments can serve as notes. When working in a team, code written by individuals is often called by multiple people. In order to make it easier for others to understand the flow of the code, using comments is very effective.
1. Python single-line comment symbol (#)
The pound sign (#) is often used as a single-line comment symbol and is used in the code #, any data to the right of it will be ignored and treated as a comment.
print 1 #输出1
# The content to the right 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 comments are needed. Multi-line comments are enclosed in triple quotes ''' '''
Related recommendations: "Python Tutorial"
The above is the detailed content of What are python annotations?. For more information, please follow other related articles on the PHP Chinese website!