Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Python3 comment


May 10, 2021 Python3



Make sure you use the correct style for modules, functions, methods, and in-line comments

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

A single-line comment in Python begins with a hashtag, for example:

#!/usr/bin/python3 
#coding=utf-8
# 这是一个注释
print("Hello, World") 

Multi-line comments include what needs to be commented with three single quotes ('''') or three double quotes ('), for example:

1, single quotes (''

#!/usr/bin/python3 
#coding=utf-8
'''
这是多行注释,用三个单引号
这是多行注释,用三个单引号 
这是多行注释,用三个单引号
'''
print("Hello, World!") 

2, double quotes (""""")

#!/usr/bin/python3 
#coding=utf-8
"""
这是多行注释,用三个双引号
这是多行注释,用三个双引号 
这是多行注释,用三个双引号
"""
print("Hello, World!")