Single-line comments in python start with #.
#!/usr/bin/python # -*- coding: UTF-8 -*- # 文件名:test.py # 第一个注释 print "Hello, Python!" # 第二个注释
Output result:
Hello, Python!
Comments can be at the end of the statement or expression line:
name = "Madisetti" # 这是一个注释
Multi-line comments in python use three single quotes (''') or three double quotation marks (""").
#!/usr/bin/python # -*- coding: UTF-8 -*- # 文件名:test.py ''' 这是多行注释,使用单引号。 这是多行注释,使用单引号。 这是多行注释,使用单引号。 ''' """ 这是多行注释,使用双引号。 这是多行注释,使用双引号。 这是多行注释,使用双引号。 """
For more Python-related technical articles, please visit the Python Tutorial column to learn!
The above is the detailed content of What symbol does Python use to represent comments?. For more information, please follow other related articles on the PHP Chinese website!