下述参考Python DOC
https://docs.python.org/zh-cn/3/library/index.html
- 概述
- 可用性注释
- 内置函数
- 内置常量
- 由
site
模块添加的常量
- 由
- 内置类型
- 逻辑值检测
- 布尔运算 ---
and
,or
,not
- 比较
- 数字类型 ---
int
,float
,complex
- 迭代器类型
- 序列类型 ---
list
,tuple
,range
- 文本序列类型 ---
str
- 二进制序列类型 ---
bytes
,bytearray
,memoryview
- 集合类型 ---
set
,frozenset
- 映射类型 ---
dict
- 上下文管理器类型
- 其他内置类型
- 特殊属性
- 内置异常
- 基类
- 具体异常
- 警告
- 异常层次结构
- 文本处理服务
string
--- 常见的字符串操作re
--- 正则表达式操作difflib
--- 计算差异的辅助工具textwrap
--- 文本自动换行与填充unicodedata
--- Unicode 数据库stringprep
--- 因特网字符串预备readline
--- GNU readline 接口rlcompleter
--- GNU readline 的补全函数
- 二进制数据服务
struct
--- 将字节串解读为打包的二进制数据codecs
--- 编解码器注册和相关基类
- 数据类型
datetime
--- 基本的日期和时间类型calendar
--- 日历相关函数collections
--- 容器数据类型collections.abc
--- 容器的抽象基类heapq
--- 堆队列算法bisect
--- 数组二分查找算法array
--- Efficient arrays of numeric valuesweakref
--- 弱引用types
--- Dynamic type creation and names for built-in typescopy
--- 浅层 (shallow) 和深层 (deep) 复制操作pprint
--- 数据美化输出reprlib
--- Alternaterepr()
implementationenum
--- Support for enumerations
- 数字和数学模块
numbers
--- 数字的抽象基类math
--- 数学函数cmath
——关于复数的数学函数decimal
--- 十进制定点和浮点运算fractions
--- 分数random
--- 生成伪随机数statistics
--- Mathematical statistics functions
- 函数式编程模块
itertools
--- 为高效循环而创建迭代器的函数functools
--- 高阶函数和可调用对象上的操作operator
--- 标准运算符替代函数
- 文件和目录访问
pathlib
--- 面向对象的文件系统路径os.path
--- 常见路径操作fileinput
--- Iterate over lines from multiple input streamsstat
--- Interpretingstat()
resultsfilecmp
--- 文件及目录的比较tempfile
--- Generate temporary files and directoriesglob
--- Unix style pathname pattern expansionfnmatch
--- Unix filename pattern matchinglinecache
--- Random access to text linesshutil
--- High-level file operationsmacpath
--- Mac OS 9 路径操作函数
- 数据持久化
pickle
—— Python 对象序列化copyreg
--- Registerpickle
support functionsshelve
--- Python object persistencemarshal
--- Internal Python object serializationdbm
--- Interfaces to Unix "databases"sqlite3
--- SQLite 数据库 DB-API 2.0 接口模块
- 数据压缩和存档
zlib
--- 与 gzip 兼容的压缩gzip
--- 对 gzip 格式的支持bz2
--- 对 bzip2 压缩算法的支持lzma
--- 用 LZMA 算法压缩zipfile
--- 使用ZIP存档tarfile
--- 读写tar归档文件
- 文件格式
csv
--- CSV 文件读写configparser
--- Configuration file parsernetrc
--- netrc file processingxdrlib
--- Encode and decode XDR dataplistlib
--- Generate and parse Mac OS X.plist
files
- 加密服务
hashlib
--- 安全哈希与消息摘要hmac
--- 基于密钥的消息验证secrets
--- Generate secure random numbers for managing secrets
- 通用操作系统服务
os
--- 操作系统接口模块io
--- 处理流的核心工具time
--- 时间的访问和转换argparse
--- 命令行选项、参数和子命令解析器getopt
--- C-style parser for command line options- 模块
logging
--- Python 的日志记录工具 logging.config
--- 日志记录配置logging.handlers
--- Logging handlersgetpass
--- 便携式密码输入工具curses
--- 终端字符单元显示的处理curses.textpad
--- Text input widget for curses programscurses.ascii
--- Utilities for ASCII characterscurses.panel
--- A panel stack extension for cursesplatform
--- 获取底层平台的标识数据errno
--- Standard errno system symbolsctypes
--- Python 的外部函数库
- 并发执行
threading
--- 基于线程的并行multiprocessing
--- 基于进程的并行concurrent
包concurrent.futures
--- 启动并行任务subprocess
--- 子进程管理sched
--- 事件调度器queue
--- 一个同步的队列类_thread
--- 底层多线程 API_dummy_thread
---_thread
的替代模块dummy_threading
--- 可直接替代threading
模块。
contextvars
--- Context Variables- Context Variables
- Manual Context Management
- asyncio support
- 网络和进程间通信
asyncio
--- 异步 I/Osocket
--- 底层网络接口ssl
--- TLS/SSL wrapper for socket objectsselect
--- Waiting for I/O completionselectors
--- 高级 I/O 复用库asyncore
--- 异步socket处理器asynchat
--- 异步 socket 指令/响应 处理器signal
--- 设置异步事件处理程序mmap
--- 内存映射文件支持
- 互联网数据处理
email
--- 电子邮件与 MIME 处理包json
--- JSON 编码和解码器mailcap
--- Mailcap file handlingmailbox
--- Manipulate mailboxes in various formatsmimetypes
--- Map filenames to MIME typesbase64
--- Base16, Base32, Base64, Base85 数据编码binhex
--- 对binhex4文件进行编码和解码binascii
--- 二进制和 ASCII 码互转quopri
--- Encode and decode MIME quoted-printable datauu
--- Encode and decode uuencode files
- 结构化标记处理工具
html
--- 超文本标记语言支持html.parser
--- 简单的 HTML 和 XHTML 解析器html.entities
--- HTML 一般实体的定义- XML处理模块
xml.etree.ElementTree
--- The ElementTree XML APIxml.dom
--- The Document Object Model APIxml.dom.minidom
--- Minimal DOM implementationxml.dom.pulldom
--- Support for building partial DOM treesxml.sax
--- Support for SAX2 parsersxml.sax.handler
--- Base classes for SAX handlersxml.sax.saxutils
--- SAX Utilitiesxml.sax.xmlreader
--- Interface for XML parsersxml.parsers.expat
--- Fast XML parsing using Expat
- 互联网协议和支持
webbrowser
--- 方便的Web浏览器控制器cgi
--- Common Gateway Interface supportcgitb
--- Traceback manager for CGI scriptswsgiref
--- WSGI Utilities and Reference Implementationurllib
--- URL 处理模块urllib.request
--- 用于打开 URL 的可扩展库urllib.response
--- urllib 使用的 Response 类urllib.parse
--- Parse URLs into componentsurllib.error
--- urllib.request 引发的异常类urllib.robotparser
--- robots.txt 语法分析程序http
--- HTTP 模块http.client
--- HTTP 协议客户端ftplib
--- FTP protocol clientpoplib
--- POP3 protocol clientimaplib
--- IMAP4 protocol clientnntplib
--- NNTP protocol clientsmtplib
---SMTP协议客户端smtpd
--- SMTP Servertelnetlib
--- Telnet clientuuid
--- UUID objects according to RFC 4122socketserver
--- A framework for network servershttp.server
--- HTTP 服务器http.cookies
--- HTTP state managementhttp.cookiejar
--- Cookie handling for HTTP clientsxmlrpc
--- XMLRPC 服务端与客户端模块xmlrpc.client
--- XML-RPC client accessxmlrpc.server
--- Basic XML-RPC serversipaddress
--- IPv4/IPv6 manipulation library
- 多媒体服务
audioop
--- Manipulate raw audio dataaifc
--- Read and write AIFF and AIFC filessunau
--- 读写 Sun AU 文件wave
--- 读写WAV格式文件chunk
--- Read IFF chunked datacolorsys
--- 颜色系统间的转换imghdr
--- 推测图像类型sndhdr
--- 推测声音文件的类型ossaudiodev
--- Access to OSS-compatible audio devices
- 国际化
gettext
--- 多语种国际化服务locale
--- 国际化服务
- 程序框架
turtle
--- 海龟绘图cmd
--- 支持面向行的命令解释器shlex
--- Simple lexical analysis
- Tk图形用户界面(GUI)
tkinter
--- Tcl/Tk的Python接口tkinter.ttk
--- Tk themed widgetstkinter.tix
--- Extension widgets for Tktkinter.scrolledtext
--- 滚动文字控件- IDLE
- 其他图形用户界面(GUI)包
- 开发工具
typing
--- 类型标注支持pydoc
--- Documentation generator and online help systemdoctest
--- 测试交互性的Python示例unittest
--- 单元测试框架unittest.mock
--- mock object libraryunittest.mock
上手指南- 2to3 - 自动将 Python 2 代码转为 Python 3 代码
test
--- Regression tests package for Pythontest.support
--- Utilities for the Python test suitetest.support.script_helper
--- Utilities for the Python execution tests
- 调试和分析
bdb
--- Debugger frameworkfaulthandler
--- Dump the Python tracebackpdb
--- Python的调试器- The Python Profilers
timeit
--- 测量小代码片段的执行时间trace
--- Trace or track Python statement executiontracemalloc
--- Trace memory allocations
- 软件打包和分发
distutils
--- 构建和安装 Python 模块ensurepip
--- Bootstrapping thepip
installervenv
--- 创建虚拟环境zipapp
--- Manage executable Python zip archives
- Python运行时服务
sys
--- 系统相关的参数和函数sysconfig
--- Provide access to Python's configuration informationbuiltins
--- 内建对象__main__
--- 顶层脚本环境warnings
--- Warning controldataclasses
--- 数据类contextlib
--- Utilities forwith
-statement contextsabc
--- 抽象基类atexit
--- 退出处理器traceback
--- 打印或检索堆栈回溯__future__
--- Future 语句定义gc
--- 垃圾回收器接口inspect
--- 检查对象site
--- Site-specific configuration hook
- 自定义 Python 解释器
code
--- Interpreter base classescodeop
--- 编译Python代码
- 导入模块
zipimport
--- Import modules from Zip archivespkgutil
--- Package extension utilitymodulefinder
--- 查找脚本使用的模块runpy
--- Locating and executing Python modulesimportlib
---import
的实现
- Python 语言服务
parser
--- Access Python parse treesast
--- 抽象语法树symtable
--- Access to the compiler's symbol tablessymbol
--- 与 Python 解析树一起使用的常量token
--- 与Python解析树一起使用的常量keyword
--- 检验Python关键字tokenize
--- Tokenizer for Python sourcetabnanny
--- 模糊缩进检测pyclbr
--- Python class browser supportpy_compile
--- Compile Python source filescompileall
--- Byte-compile Python librariesdis
--- Python 字节码反汇编器pickletools
--- Tools for pickle developers
- 杂项服务
formatter
--- Generic output formatting
- Windows系统相关模块
msilib
--- Read and write Microsoft Installer filesmsvcrt
--- Useful routines from the MS VC++ runtimewinreg
--- Windows 注册表访问winsound
--- Sound-playing interface for Windows
- Unix 专有服务
posix
--- The most common POSIX system callspwd
--- 用户密码数据库spwd
--- The shadow password databasegrp
--- The group databasecrypt
--- Function to check Unix passwordstermios
--- POSIX style tty controltty
--- 终端控制功能pty
--- Pseudo-terminal utilitiesfcntl
--- Thefcntl
andioctl
system callspipes
--- Interface to shell pipelinesresource
--- Resource usage informationnis
--- Interface to Sun's NIS (Yellow Pages)- Unix syslog 库例程
- 被取代的模块
optparse
--- Parser for command line optionsimp
--- Access the import internals
- 未创建文档的模块
- 平台特定模块
对于以上标准库,参考PythonDOC:https://docs.python.org/zh-cn/3/library/index.html
常用的库:
time
datetime
random 随机数
os 与操作系统交互的接口
sys 与Python程序本身相关
hashlib
shutil 高级的 文件、文件夹、压缩包 处理模块
json&pickle 补充eval函数的功能(将一个字符串转成python对象)
logging 打印日志
string
————————(我是分割线)————————
参考:
1. https://docs.python.org/zh-cn/3/library/index.html
备注:
初次编辑时间:2019年10月3日09:42:32
环境:Windows 7 / Python 3.7.2