The Python 3 Standard Library cover

The Python 3 Standard Library

Rating 4.2
Chapters
23
Series
HZ Books Programmer's Library
ISBN
9787111608950

Tags

Summary

This book is the Chinese translation of The Python 3 Standard Library by Example, written by the veteran Python developer and Red Hat engineer Doug Hellmann and translated into Chinese by Su Jinguo, Li Huang, and others; it runs to about 1,085 pages and 19 chapters. The author compiled his long-running "Python Module of the Week (PyMOTW)" series into a book that takes an example-first approach, explaining hundreds of modules in the Python 3 standard library one by one: for each module it first states what problem it solves, then gives short, independently runnable sample code with real output, and finally points out common parameters, pitfalls, and further resources. The book is organized by functional domain, covering text processing (string, textwrap, re, difflib), data structures (enum, collections, array, heapq, queue, struct), algorithms and functional tools (functools, itertools, contextlib), dates and times, mathematics, the file system, data persistence and interchange (json, dbm, sqlite3), compression and archiving, cryptography, concurrency with processes, threads, and coroutines, network communication and Internet protocols, email, application building blocks, internationalization and localization, development and debugging tools, runtime features, language tools, and the import mechanism for modules and packages. The appendices also provide a Python 2 to 3 porting guide and a guide to common third-party libraries outside the standard library. Its purpose is not to replace the official documentation but to use runnable examples to help readers build an overall map of the standard library, so they can quickly find the right module and use it correctly when needed.

Editor's review

很多 Python 学习者把“会写语法”当成入门完成,真正的分水岭却是能不能熟练调用标准库:文件怎么切、日期怎么算、数据怎么序列化、进程线程怎么协作、网络协议怎么拼,答案几乎都在“自带电池”里。这本《Python 3标准库》正是为此而生。 第一,案例驱动,拒绝照抄手册。书中每个模块都配有可直接运行的示例和真实输出,读者看到的是“代码做了什么”,而不只是函数签名。第二,结构清晰,按功能域分章,19 章覆盖文本、数据结构、算法、时间、数学、文件、持久化、压缩、加密、并发、网络、邮件、国际化、开发工具与运行时,既是系统读物,也是随手查阅的索引。第三,作者道格·赫尔曼是 Python 软件基金会成员、PyMOTW 系列作者,示例经过大量读者验证;中文版完整保留原书篇幅,约 1085 页,并补齐移植说明与扩展阅读。 需要提醒的是,本书不是零基础教材,它更像一张“标准库地图加工具手册”。读者把它放在手边,遇到具体任务时翻到对应章节,比从头通读收获更大。

Who it's for

A good fit for

  • 已掌握 Python 基础语法、能独立写脚本,想系统补齐标准库知识的开发者
  • 需要经常处理文本、日期、文件、网络、并发等日常任务的工程人员
  • 希望从 Python 2 迁移到 Python 3,需要了解标准库差异的旧版用户
  • 把本书当作案头参考、按任务目录检索解决方案的中高级程序员

Not a good fit for

  • 完全没有编程基础的初学者,应先读入门教材再回来
  • 只想学 Web 框架、数据分析或机器学习第三方库的人,本书基本不涉及这些内容
  • 期待循序渐进练习题与课后作业的培训课学员

Reading tips

  1. 第一遍先读前 3 章与第 17—19 章,建立“标准库如何组织”的整体认知,其余按需查阅。
  2. 每读一个模块,就在自己的 Python 环境里跑一遍示例并改写参数,观察输出变化。
  3. 把常用片段(日志配置、JSON 读写、subprocess、threading)整理成个人代码片段库。
  4. 注意书中示例基于较早的 Python 3 版本,实践时对照当前官方文档核对已弃用的 API。

About the publisher

China Machine Press China · Founded in 1950

In addition to science and technology and professional publishing, the books in our catalog from China Machine Press also reflect a sustained focus on psychology, computing, management, finance and economics, and social sciences. In psychology, the catalog includes works by C. G. Jung and introductions to analytical psychology, as well as applied topics such as stress and health, and addiction and healing. In computing, it features Structure and Interpretation of Computer Programs (JavaScript Edition). Management and finance titles include Administrative Behavior (4th Edition), The Price of Inequality (Collector's Edition), and This Time Is Different: Eight Centuries of Financial Folly (Commemorative Edition). In the philosophy and history of science, there is The Worldview: The Third Edition. Relevant authors include C. G. Jung, William McGuire, Sonu Shamdasani, and Gabor Maté. Public information is limited; the above summarizes the publisher's profile based solely on the books in our catalog.

Contents

  1. Translator's Preface
  2. Preface
  3. Chapter 1 Text
  4. Chapter 2 Data Structures
  5. Chapter 3 Algorithms
  6. Chapter 4 Dates and Times
  7. Chapter 5 Mathematics
  8. Chapter 6 The File System
  9. Chapter 7 Data Persistence and Exchange
  10. Chapter 8 Data Compression and Archiving
  11. Chapter 9 Cryptography
  12. Chapter 10 Concurrency with Processes, Threads, and Coroutines
  13. Chapter 11 Networking
  14. Chapter 12 The Internet
  15. Chapter 13 email
  16. Chapter 14 Application Building Blocks
  17. Chapter 15 Internationalization and Localization
  18. Chapter 16 Developer Tools
  19. Chapter 17 Runtime Features
  20. Chapter 18 Language Tools
  21. Chapter 19 Modules and Packages
  22. Appendix A Porting Notes
  23. Appendix B Beyond the Standard Library

FAQ

这本书适合零基础学 Python 的人吗?
不太适合。原书明确面向中等程度的 Python 程序员,示例只对少数代码逐行解释,默认读者已熟悉语法、函数与模块导入。零基础读者建议先完成一本入门教材,再回来把它当工具书。
它和官方标准库文档有什么区别?
官方文档偏重接口说明,本书偏重“用例子说明行为”:每个模块都给出可运行代码和真实输出,并解释为什么这样设计、常见坑在哪里,更适合建立直观认识;但具体版本的最新接口仍应以官方文档为准。
书里的内容对现在的 Python 版本还有效吗?
核心模块与用法大多长期稳定,因此仍有很高参考价值;但书中部分 API(如旧的线程、异步写法)在后来的 Python 版本中已被弃用或调整,动手时请对照当前版本官方文档核对。
中文版和英文原版是什么关系?
中文版译自道格·赫尔曼的《The Python 3 Standard Library by Example》(Addison-Wesley,2017,约 1456 页),由苏金国、李璜等翻译,机械工业出版社 2018 年出版,共 19 章并含两个附录。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

Top rated in the same category