You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
878 B
Markdown

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
icon: edit
date: 2021-09-20
category:
- python
tag:
- python
- 注释
headerDepth: 5
---
# Python3 注释
# Python3 注释
确保对模块, 函数, 方法和行内注释使用正确的风格
Python中的注释有单行注释和多行注释
Python中单行注释以 # 开头,例如::
```python
# 这是一个注释
print("Hello, World!")
```
多行注释用三个单引号 ''' 或者三个双引号 """ 将注释括起来,例如:
## 1、单引号'''
```python
#!/usr/bin/python3
'''
这是多行注释,用三个单引号
这是多行注释,用三个单引号
这是多行注释,用三个单引号
'''
print("Hello, World!")
```
## 2、双引号"""
```python
#!/usr/bin/python3
"""
这是多行注释,用三个双引号
这是多行注释,用三个双引号
这是多行注释,用三个双引号
"""
print("Hello, World!")
```