实例介绍
【实例简介】很不错的Python中文帮助手册
CONTENTS
1 Whetting Your Appetite 1
2 Using the Python Interpreter 3
2.1 调用解释器Invoking the Interpreter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 解释器及其环境The Interpreter and Its Environment . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 Python简 简 介 介An Informal Introduction to Python 9
3.1 将Python当作计算器使用Using Python as a Calculator . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 开始编程First Steps Towards Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4 More Control Flow Tools 23
4.1 if 语句if Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.2 for 语句for Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.3 range() 函数The range() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.4 break 和continue 语句, 以及循环中的else 子句break and continue Statements, and
else Clauses on Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.5 pass 语句pass Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.6 Defining Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.7 深入函数定义More on Defining Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5 Data Structures 35
5.1 深入链表More on Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.2 del 语句 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.3 元组(Tuples)和序列(Sequences )Tuples and Sequences . . . . . . . . . . . . . . . . . . . . 41
5.4 Dictionaries 字典 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.5 循环技巧Looping Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.6 深入条件控制More on Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
5.7 比较序列和其它类型Comparing Sequences and Other Types . . . . . . . . . . . . . . . . . . . . . 45
6 Modules 47
6.1 深入模块More on Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
6.2 标准模块Standard Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
6.3 dir() 函数dir() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.4 包Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
7 Input and Output 59
7.1 设计输出格式Fancier Output Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
7.2 读写文件Reading and Writing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
8 Errors and Exceptions 67
i
8.1 异常Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
8.2 处理异常Handling Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
8.3 抛出异常Raising Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
8.4 用户自定义异常User-defined Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
8.5 定义清理行为Defining Clean-up Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
9 Classes 75
9.1 有关术语的话题A Word About Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
9.2 Python 作用域和命名空间Python Scopes and Name Spaces . . . . . . . . . . . . . . . . . . . . . 76
9.3 初识类A First Look at Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
9.4 一些说明Random Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
9.5 继承Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
9.6 私有变量Private Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
9.7 补充Odds and Ends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
9.8 异常也是类Exceptions Are Classes Too . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
9.9 迭代器Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
9.10 生成器Generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
10 Brief Tour of the Standard Library 91
10.1 操作系统概览Operating System Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
10.2 文件通配符File Wildcards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
10.3 命令行参数Command Line Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
10.4 错误输出重定向和程序终止Error Output Redirection and Program Termination . . . . . . . . . . 92
10.5 字符串正则匹配String Pattern Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
10.6 数学Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
10.7 互联网访问Internet Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
10.8 日期和时间Dates and Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
10.9 数据压缩Data Compression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
10.10 性能度量Performance Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
10.11 质量控制Quality Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
10.12 Batteries Included . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
11 What Now? 99
A Interactive Input Editing and History Substitution 101
A.1 Line Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
A.2 History Substitution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
A.3 Key Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
A.4 Commentary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
B Floating Point Arithmetic: Issues and Limitations 105
B.1 Representation Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
C History and License 109
C.1 History of the software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
C.2 Terms and conditions for accessing or otherwise using Python . . . . . . . . . . . . . . . . . . . . . 110
C.3 Licenses and Acknowledgements for Incorporated Software . . . . . . . . . . . . . . . . . . . . . . 112
D Glossary 121
Index 125
【实例截图】
文件清单
└── Python 中文手册.pdf
0 directories, 1 file
标签:
相关软件
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论