What are the python program comment symbols?

silencement
Release: 2022-06-08 14:30:07
Original
21044 people have browsed it

What are the python program comment symbols?

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, which will be introduced in the article. 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. When # is used in the code, the right side of it Any data will be ignored and treated as comments. The content to the right of

def func():
    print("hello") #这个函数是的功能是打印hello
Copy after login

# 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, multiple lines need to be batched. line comment. Multi-line comments are enclosed in triple quotes ''' ''', for example:

'''
多行注释符
'''
Copy after login

or

"""
多行注释符
"""
Copy after login

The above is the detailed content of What are the python program comment symbols?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!