Python专业人士笔记Ch3 缩进,Ch4注释及文档说明
2018-03-31 10:02
531 查看
3.1: Simple example
: are used to declare an indented codeblock冒号声明缩进
3.2: How Indentation is Parsed
3.3: Indentation Errors
4: Comments and Documentation注释及文档说明
4.1: Single line, inline and multilinecomments
Single line comment单行注释
# This is a single line comment in Python
Inline comment行内注释
print("Hello World") # This lineprints "Hello World"
Comments spanning multiple lines have""" or ''' 多行注释用三层双引号或单引号
"""
This type of comment spans multiple lines.
These are mostly used for documentation offunctions, classes and modules.
"""
4.2: Programmatically accessing docstrings编程用文档说明
用help()或func.__doc__访问函数内部说明
4.3: Write documentation using docstrings
: are used to declare an indented codeblock冒号声明缩进
3.2: How Indentation is Parsed
3.3: Indentation Errors
4: Comments and Documentation注释及文档说明
4.1: Single line, inline and multilinecomments
Single line comment单行注释
# This is a single line comment in Python
Inline comment行内注释
print("Hello World") # This lineprints "Hello World"
Comments spanning multiple lines have""" or ''' 多行注释用三层双引号或单引号
"""
This type of comment spans multiple lines.
These are mostly used for documentation offunctions, classes and modules.
"""
4.2: Programmatically accessing docstrings编程用文档说明
用help()或func.__doc__访问函数内部说明
4.3: Write documentation using docstrings
def hello(name): """Greet someone. Print a greeting ("Hello") for the person with the given name. """ print("Hello "+name) class Greeter: """An object used to greet people.Python® Notes for Professionals 38 It contains multiple greeting functions for several languages and times of the day. """
相关文章推荐
- Python学习笔记——注释,缩进,字符串与与整型的转换
- python整理笔记3---__doc__(文档字符串)
- Python学习笔记:缩进
- 黑马程序员:给class文件写说明书,java的说明说通过文档注释来完成
- Python学习笔记:02 基础:变量、整数、字符串、赋值、基本输出、注释、代码块
- Python-uiautomator使用说明文档
- Python3学习笔记03-基本数据类型、序列、运算及缩进和选择
- 写好python的注释文档很容易
- odoo8.0开发笔记(一):Notepad ++的自动缩进引发python的问题
- 【Python学习笔记】print语句和注释
- java笔记-面向对象-匿名对象、说明文档、单例设计模式
- Python学习笔记(29)-Python创建并写入word文档
- 初学Python的学习笔记12----单元测试、文档测试和文件读写
- python一些包的说明文档/教程链接
- php常见文档注释说明
- Python 笔记 #07# NumPy 文档地址 & Subsetting 2D Arrays
- Python学习笔记010——函数文档字符串
- Django使用Python操作数据库 --Django 1.8.2 文档(中文)部分笔记
- 【Python】学习笔记五:缩进与选择
- Java文档注释说明