How to write python comments

藏色散人
Release: 2019-06-24 10:20:58
Original
5129 people have browsed it

How to write python comments

How to write python comments?

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

Comments in Python have single-line comments and multi-line comments:

Single-line comments in Python begin with #, for example:

# 这是一个注释
print("Hello, World!")
Copy after login

Multi-line comments are enclosed in three single quotes ''' or three double quotes """, for example:

1. Single quotation marks (''')

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

2. Double quotation marks (""")

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

Related recommendations: "Python Tutorial

The above is the detailed content of How to write python comments. 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 [email protected]
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!