Python comments, python comments multiple lines
Annotations are used to describe the functions of the Code, the algorithms used, the code writers, and the creation and modification time.
Annotations are part of the code and play a complementary role in code description.
Python Annotation
A single-line comment in Python starts with #. A single-line comment can be placed on the annotated code line as a separate line, or after a statement or expression.
#Give you a chance to let you know meprint("Give you a chance to let you know me")say_what = "this is a demo" #at the end of a line
In Python, multiple-line comments use three single quotes (''') or three double quotes ("). In fact, this is the writing method of multiple-line strings, it is not a multi-line comment advocated by Python itself.
Python notes see: https://docs.python.org/3/reference/lexical_analysis.html#comments
# File name: test. py ''' this is a multi-line comment, using single quotes. This is a multi-line comment, using single quotes. ''' "Is a multi-line comment with double quotation marks. This is a multi-line comment with double quotation marks. """
Python also has some special annotations to complete some special functions, such as coding comments and platform comments.
Encoding notes:
#-*-Coding: UTF-8-*-print ("Hello, Python ");
From Python3, Python uses UTF-8 encoding by default, so the Python3.x source file does not require a special declaration of UTF-8 encoding.
See https://www.python.org/dev/peps/pep-0008/#source-file-encoding
Platform Note: To enable Python to run on a Windows platform, add the following comment at the beginning of the Python file.
#!/usr/bin/python
#! /Usr/bin/python describes the path of the Environment used by the program.
If you use a text editor for Python program editing comments, you can also use it for program debugging. The program is divided into several parts to comment out unnecessary code and focus on the Code logic currently written.