Python - Comments

1. What does the comment look like? (What)

#注释长这样:
#这是注释,一次一行
'''这也是注释
还是注释,一次多行
'''
"""依旧是注释
注释注释,一次多行,和上一个用法相同。
"""

2. What can annotation do? (Why)

1. Prevent yourself from being unable to understand why you write this here in the future
2. Let others know what you are doing before they lose patience and annoyed
3. Assist in debugging code
4. Others (but this is very important), such as:

#!usr/bin/python3
# -*- coding: utf-8 -*-

The first line indicates that the python3 interpreter is used, and the second line indicates that the encoding format is utf-8

3. How to quickly annotate a large amount of code? (How)

Most editors use "Ctrl + /", which may be different in different environments and can be queried for specific editors.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324731584&siteId=291194637