Python3标准库使用样例

原:https://doughellmann.com/blog/the-python-3-standard-library-by-example/the-python-3-standard-library-by-example-table-of-contents/

已经有人在维护中文翻译了https://learnku.com/docs/pymotw

目录:

第一章:文本
  • string:文本常量和模板
  • textwrap:格式化文本句子
  • re:正则表达式
  • difflib:比对序列
第二章:数据结构
  • enum:枚举类型
  • array:可修改序列
  • heapq:堆排序算法
  • bisect:操纵有序列表
  • queue:线程安全的先进先出实现
  • struct:二进制数据结构
  • weakref:对象的非永久引用
  • copy:拷贝对象
  • print:美化输出数据结构
第三章:算法
  • functools:操作函数的工具
  • itertools:迭代器函数
  • operator:内建操作符的函数化接口
  • contextlib:上下文管理工具集
第四章:日期和时间
  • time:时钟时间
  • datetime:日期和时间值操作
  • calendar:操作日期
第五章:数学
  • decimal:浮点数
  • fractions:有理数
  • random:随机数生成
  • math:数学函数
  • statistics:统计计算
第六章:文件系统
  • os.path:系统独立的文件名操作
  • pathlib:作为对象的文件系统路径
  • glob:文件名路径匹配
  • fnmatch:Unix风格的Glob模式匹配
  • linecache:高效读取文本文件
  • tempfile:临时文件系统对象
  • shutil:高级文件操作
  • filecmp:比对文件
  • mmap: 内存映射文件
  • codecL字符串编码和解码
  • io:文本、二进制和原始I/O流对象
第七章:数据持久化和数据交换
  • pickle:对象序列化
  • shelve:对象的持久存储
  • dbm:Unix键值对数据库
  • sqlite3:嵌入式关系型数据库
  • xml.etree.ElementTree:XML操作API
    +csv:逗号分隔符文件
第八章:数据压缩和打包
  • zlib:GNUzlib压缩
  • gzip:读写GNU zip文件
  • bz2:bzip2压缩
  • tarfile:Tar包访问
  • zipfile:Zip包访问
第九章:加密
  • hashlib:哈希加密
  • hmac:消息签名和验证
第十章:通过进程、线程和协程实现并发
  • subprocess:Spawn额外的进程
  • signal:异步系统事件
  • threading:在一个进程内管理并发操作
  • multiprocessing:像线程一样管理进程
  • asyncio:异步IO、时间循环和并发工具
  • concurrent.futures:管理并发任务池
第十一章:网络
  • ipaddress:互联网地址
  • socket:网络通信
  • selectors:I/O多路复用抽象
  • select:高效的I/O等待
  • socketserver:创建网络服务器
第十二章:互联网
  • urllib.parse:将网址分隔成独立的部分
  • urllib.request:网络资源访问
  • urllib.robotparser:互联网爬虫访问控制
  • base64:使用ASCII编码二进制数据
  • http.server:实现Web服务器的基类
  • http.cookies:HTTP Cookies
  • webbrowser: 显示网页
  • uuid:通用唯一标识
  • json:JavaScript对象
  • xmlrpc.client:XML-PRC的客户端
  • xmlrc.server:XML-RPC的服务端
第十三章:电子邮件
  • stmplib:简单邮件传输协议客户端
  • smtpd:电子邮件服务器
  • mailbox:操作邮件包
  • imaplib:IMAP4客户端库
第十四章:应用构建块
  • argparse:命令行选项和参数解析
  • getopt:命令行选项j解析
  • readline:GNUreadline库
  • getpass:安全密码Prompt
  • cmd:面向行的命令处理器
  • shelx:解析Shell风格语法
  • configparser:操作配置文件
  • logging:报告状态,错误和信息化消息
  • fileinput:命令行过滤框架
  • atexit:程序退出回调
  • sched:时间化事件调度
第十五章:国际化和本地化
  • gettext:消息Catalogs
  • locale:文化本地化API
第十六章:开发者工具
  • pydoc:模块的在线帮助
  • doctest:通过文档测试
  • unittest:自动测试框架
  • trace:跟随程序流程
  • traceback:异常和栈追踪
  • cgitb:详细追踪报告
  • pdb:交互式调试器
  • profile和pstats:性能分析
  • timeit:小Python代码块的执行时间
  • tabnanny:标识验证器
  • compileall:字节编译源码
  • pyclbr:类浏览器
  • venv:创建虚拟环境
  • ensurepip:安装Python包下载器
第十七章:运行时功能
  • site:全站配置
  • sys:系统配置
  • os:操作操作系统
  • platform:系统版本信息
  • resource:系统资源管理
  • gc:垃圾回收器
  • sysconfig:解释器编译时配置
第十八章:语言工具
  • warnings:非致命警告
  • abc:抽象基类
  • dis:Python字节码反汇编
  • inspect:检视实时对象
第十九章:模块和包
  • importlib:Python的导入机制
  • pkgutil:包工具
  • zipimport:从ZIP包中加载Python代码

转载于:https://www.cnblogs.com/taceywong/p/9353944.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
The Python 3 Standard Library by Example (Developer's Library) by Doug Hellmann English | 12 Jun. 2017 | ASIN: B072QZZDV7 | 1456 Pages | AZW3 | 199.27 MB This is the eBook of the printed book and may not include any media, website access codes, or print supplements that may come packaged with the bound book. Master the Powerful Python 3 Standard Library through Real Code Examples “The genius of Doug’s approach is that with 15 minutes per week, any motivated programmer can learn the Python Standard Library. Doug’s guided tour will help you flip the switch to fully power-up Python’s batteries.” –Raymond Hettinger, Distinguished Python Core Developer The Python 3 Standard Library contains hundreds of modules for interacting with the operating system, interpreter, and Internet–all extensively tested and ready to jump-start application development. Now, Python expert Doug Hellmann introduces every major area of the Python 3.x library through concise source code and output examples. Hellmann’s examples fully demonstrate each feature and are designed for easy learning and reuse. You’ll find practical code for working with text, data structures, algorithms, dates/times, math, the file system, persistence, data exchange, compression, archiving, crypto, processes/threads, networking, Internet capabilities, email, developer and language tools, the runtime, packages, and more. Each section fully covers one module, with links to additional resources, making this book an ideal tutorial and reference. The Python 3 Standard Library by Example introduces Python 3.x’s new libraries, significant functionality changes, and new layout and naming conventions. Hellmann also provides expert porting guidance for moving code from 2.x Python standard library modules to their Python 3.x equivalents. Manipulate text with string, textwrap, re (regular expressions), and difflib Use data structures: enum, collections, array, heapq, queue, struct, copy, and more Implement algorithms elegantly and concisely with functools, itertools, and contextlib Handle dates/times and advanced mathematical tasks Archive and data compression Understand data exchange and persistence, including json, dbm, and sqlite Sign and verify messages cryptographically Manage concurrent operations with processes and threads Test, debug, compile, profile, language, import, and package tools Control interaction at runtime with interpreters or the environment
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值