没有合适的资源?快使用搜索试试~ 我知道了~
首页Intermediate Python
Intermediate Python
![](https://csdnimg.cn/release/wenkucmsfe/public/img/star.98a08eaa.png)
This is a new python book that introduces some intermediate tech such as advanced function, decorators, generators etc.
资源详情
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/9214717/bg1.jpg)
![](https://csdnimg.cn/release/download_crawler_static/9214717/bg2.jpg)
Contents
I Preface 1
II Author 2
1 *args and **kwargs 3
1.1 Usage of *args . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Usage of **kwargs . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Using *args and **kwargs to call a function . . . . . . . . . . . . . 4
1.4 When to use them? . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 Debugging 6
3 Generators 8
3.1 Iterable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2 Iterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3 Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.4 Generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4 Map & Filter 12
4.1 1. Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.2 2. Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5 set Data Structure 14
i
![](https://csdnimg.cn/release/download_crawler_static/9214717/bg3.jpg)
6 Ternary Operators 16
7 Decorators 18
7.1 Everything in python is an object: . . . . . . . . . . . . . . . . . . 18
7.2 Defining functions within functions: . . . . . . . . . . . . . . . . . 19
7.3 Returning functions from within functions: . . . . . . . . . . . . . 20
7.4 Giving a function as an argument to another function: . . . . . . 21
7.5 Writing your first decorator: . . . . . . . . . . . . . . . . . . . . . 21
7.6 1. Authorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
7.7 2. Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
8 Global & Return 26
9 Mutation 28
10 __slots__ Magic 31
11 Virtual Environment 33
12 Collections 35
12.1 1.defaultdict . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
12.2 2.counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
12.3 3.deque . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
12.4 4.namedtuple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
13 Enumerate 41
14 Object introspection 43
14.1 1.dir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
14.2 2.type and id . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
14.3 3.inspect module . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
15 Comprehensions 45
15.1 list comprehensions . . . . . . . . . . . . . . . . . . . . . . . . . 45
15.2 dict comprehensions . . . . . . . . . . . . . . . . . . . . . . . . . 46
15.3 set comprehensions . . . . . . . . . . . . . . . . . . . . . . . . . . 47
16 Exceptions 48
16.1 Handling multiple exceptions: . . . . . . . . . . . . . . . . . . . . 48
17 Lambdas 51
18 One Liners 53
ii
![](https://csdnimg.cn/release/download_crawler_static/9214717/bg4.jpg)
19 For - Else 55
19.1 1.else clause: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
20 Open function 57
21 Targeting Python 2+3 60
22 Coroutines 63
23 Function caching 65
23.1 Python 3.2+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
23.2 Python 2+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
24 Context managers 67
24.1 Implementing Context Manager as a Class: . . . . . . . . . . . . . 68
24.2 Handling exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . 69
24.3 Implementing a Context Manager as a Generator . . . . . . . . . 70
iii
![](https://csdnimg.cn/release/download_crawler_static/9214717/bg5.jpg)
iv
剩余75页未读,继续阅读
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://profile-avatar.csdnimg.cn/default.jpg!1)
fatespinner123
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![](https://csdnimg.cn/release/wenkucmsfe/public/img/voice.245cc511.png)
会员权益专享
最新资源
- 基于Springboot的医院信管系统
- 基于Springboot的冬奥会科普平台
- 基于Springboot的社区医院管理服务系统
- 基于Springboot的实习管理系统
- TI-TCAN1146.pdf
- 基于Springboot的留守儿童爱心网站
- S32K3XXRM.pdf
- Ansible Automation Platform 快速安装指南 v3.8.1
- Ansible Tower 发行注记 v3.8.1-76页
- C语言笔记-考研版(进阶)
- Design_of_Analog_CMOS_Integrated_Circuit20200602-85440-9wt61m-with-cover-page-v2 (1).pdf
- Ansible Automation Platform 安装和参考指南 v3.8.1-59页
- 浅析5G技术在工业互联网领域的应用研究
- 查重17 岑彩谊-基于otn技术的本地承载网-二稿 .docx
- 自考计算机应用基础知识点.doc
- 数据库系统安全、技术操作规程.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![](https://csdnimg.cn/release/wenkucmsfe/public/img/green-success.6a4acb44.png)