Home  >  Article  >  Backend Development  >  What is used to represent comments in python

What is used to represent comments in python

藏色散人
藏色散人Original
2019-07-05 09:34:039282browse

What is used to represent comments in python

What is used to represent comments in python?

By using a language you are familiar with to annotate certain codes in the program, this is the role of comments, which can greatly enhance the readability of the program.

Make sure to use the correct style for modules, functions, methods and inline comments.

In python, use # to indicate a single-line comment, and use three single quotes ''' or three double quotes """ to enclose the comment to indicate multi-line comments.

Example:

# 这是一个注释
print("Hello, World!")
#!/usr/bin/python3 
'''
这是多行注释,用三个单引号
这是多行注释,用三个单引号 
这是多行注释,用三个单引号
'''
print("Hello, World!")
#!/usr/bin/python3 
"""
这是多行注释,用三个双引号
这是多行注释,用三个双引号 
这是多行注释,用三个双引号
"""
print("Hello, World!")

Related recommendations: "Python Tutorial"

The above is the detailed content of What is used to represent comments in python. 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
Previous article:How to comment in pythonNext article:How to comment in python