Python: Notes

Notes Methods in Python with C ++ and Java still has a little different.

Single-line comments

Single-line comments begin with #, the syntax is as follows:

# 注释内容

"#" Behind the content will be ignored by the Python editor.

Multi-line comments

Multi-line comments, then, is to three quotes for the beginning of the line, again three quotes for the end of the line, the middle is the annotation content, where single and double quotes can be used.

'''
	注释内容1
	注释内容2
	注释内容3
	......
'''
"""
	注释内容1
	注释内容2
	注释内容3
	......
"""

Chinese comments

Chinese Notes In fact Python3 has not so necessary, but sometimes in order to standardize the coding of the page, and to keep abreast of the encoded file so that others used, it is recommended in the beginning of the file with the Chinese comments.

# coding = utf-8

Code

# coding = utf-8

'''
    @ 功能:输出“你好Python”
    @ 作者:无语
    @ 时间:2020.3.24
'''

# ================== 程序开始 ================== #

print("Hello Python!") # 输出“Hello Python”

# ================== 程序结束 ================== #

Guess you like

Origin www.cnblogs.com/000zwx000/p/12559003.html