没有合适的资源?快使用搜索试试~ 我知道了~
Python标准库查询手册
需积分: 37 14 下载量 28 浏览量
2018-08-21
11:37:12
上传
评论 1
收藏 5.66MB PDF 举报
温馨提示
试读
1626页
python标准库查询手册,python标准库查询手册,python标准库查询手册。
资源推荐
资源详情
资源评论
The Python Library Reference
Release 3.4.1
Guido van Rossum
Fred L. Drake, Jr., editor
May 22, 2014
Python Software Foundation
Email: docs@python.org
CONTENTS
1 Introduction 3
2 Built-in Functions 5
3 Built-in Constants 23
3.1 Constants added by the site module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4 Built-in Types 25
4.1 Truth Value Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.2 Boolean Operations — and, or, not . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.3 Comparisons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.4 Numeric Types — int, float, complex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.5 Iterator Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.6 Sequence Types — list, tuple, range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.7 Text Sequence Type — str . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.8 Binary Sequence Types — bytes, bytearray, memoryview . . . . . . . . . . . . . . . . . 45
4.9 Set Types — set, frozenset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.10 Mapping Types — dict . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.11 Context Manager Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
4.12 Other Built-in Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
4.13 Special Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5 Built-in Exceptions 65
5.1 Base classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
5.2 Concrete exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
5.3 Warnings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.4 Exception hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6 Text Processing Services 73
6.1 string — Common string operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
6.2 re — Regular expression operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
6.3 difflib — Helpers for computing deltas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
6.4 textwrap — Text wrapping and filling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.5 unicodedata — Unicode Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
6.6 stringprep — Internet String Preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
6.7 readline — GNU readline interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
6.8 rlcompleter — Completion function for GNU readline . . . . . . . . . . . . . . . . . . . . 117
7 Binary Data Services 119
7.1 struct — Interpret bytes as packed binary data . . . . . . . . . . . . . . . . . . . . . . . . . . 119
7.2 codecs — Codec registry and base classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
8 Data Types 139
8.1 datetime — Basic date and time types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
8.2 calendar — General calendar-related functions . . . . . . . . . . . . . . . . . . . . . . . . . 164
8.3 collections — Container datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
i
8.4 collections.abc — Abstract Base Classes for Containers . . . . . . . . . . . . . . . . . . 181
8.5 heapq — Heap queue algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
8.6 bisect — Array bisection algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
8.7 array — Efficient arrays of numeric values . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
8.8 weakref — Weak references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
8.9 types — Dynamic type creation and names for built-in types . . . . . . . . . . . . . . . . . . . 199
8.10 copy — Shallow and deep copy operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
8.11 pprint — Data pretty printer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
8.12 reprlib — Alternate repr() implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 207
8.13 enum — Support for enumerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
9 Numeric and Mathematical Modules 221
9.1 numbers — Numeric abstract base classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
9.2 math — Mathematical functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
9.3 cmath — Mathematical functions for complex numbers . . . . . . . . . . . . . . . . . . . . . . 228
9.4 decimal — Decimal fixed point and floating point arithmetic . . . . . . . . . . . . . . . . . . 230
9.5 fractions — Rational numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
9.6 random — Generate pseudo-random numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
9.7 statistics — Mathematical statistics functions . . . . . . . . . . . . . . . . . . . . . . . . 261
10 Functional Programming Modules 267
10.1 itertools — Functions creating iterators for efficient looping . . . . . . . . . . . . . . . . . 267
10.2 functools — Higher-order functions and operations on callable objects . . . . . . . . . . . . 280
10.3 operator — Standard operators as functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
11 File and Directory Access 293
11.1 pathlib — Object-oriented filesystem paths . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
11.2 os.path — Common pathname manipulations . . . . . . . . . . . . . . . . . . . . . . . . . . 306
11.3 fileinput — Iterate over lines from multiple input streams . . . . . . . . . . . . . . . . . . . 310
11.4 stat — Interpreting stat() results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
11.5 filecmp — File and Directory Comparisons . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
11.6 tempfile — Generate temporary files and directories . . . . . . . . . . . . . . . . . . . . . . 318
11.7 glob — Unix style pathname pattern expansion . . . . . . . . . . . . . . . . . . . . . . . . . . 321
11.8 fnmatch — Unix filename pattern matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
11.9 linecache — Random access to text lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
11.10 shutil — High-level file operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
11.11 macpath — Mac OS 9 path manipulation functions . . . . . . . . . . . . . . . . . . . . . . . . 330
12 Data Persistence 333
12.1 pickle — Python object serialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
12.2 copyreg — Register pickle support functions . . . . . . . . . . . . . . . . . . . . . . . . . 345
12.3 shelve — Python object persistence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
12.4 marshal — Internal Python object serialization . . . . . . . . . . . . . . . . . . . . . . . . . . 348
12.5 dbm — Interfaces to Unix “databases” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
12.6 sqlite3 — DB-API 2.0 interface for SQLite databases . . . . . . . . . . . . . . . . . . . . . 352
13 Data Compression and Archiving 371
13.1 zlib — Compression compatible with gzip . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
13.2 gzip — Support for gzip files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
13.3 bz2 — Support for bzip2 compression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
13.4 lzma — Compression using the LZMA algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 378
13.5 zipfile — Work with ZIP archives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
13.6 tarfile — Read and write tar archive files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
14 File Formats 399
14.1 csv — CSV File Reading and Writing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
14.2 configparser — Configuration file parser . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
14.3 netrc — netrc file processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
14.4 xdrlib — Encode and decode XDR data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
ii
14.5 plistlib — Generate and parse Mac OS X .plist files . . . . . . . . . . . . . . . . . . . . 424
15 Cryptographic Services 427
15.1 hashlib — Secure hashes and message digests . . . . . . . . . . . . . . . . . . . . . . . . . . 427
15.2 hmac — Keyed-Hashing for Message Authentication . . . . . . . . . . . . . . . . . . . . . . . 429
16 Generic Operating System Services 433
16.1 os — Miscellaneous operating system interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . 433
16.2 io — Core tools for working with streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470
16.3 time — Time access and conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
16.4 argparse — Parser for command-line options, arguments and sub-commands . . . . . . . . . 487
16.5 optparse — Parser for command line options . . . . . . . . . . . . . . . . . . . . . . . . . . 514
16.6 getopt — C-style parser for command line options . . . . . . . . . . . . . . . . . . . . . . . . 539
16.7 logging — Logging facility for Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
16.8 logging.config — Logging configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 554
16.9 logging.handlers — Logging handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
16.10 getpass — Portable password input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574
16.11 curses — Terminal handling for character-cell displays . . . . . . . . . . . . . . . . . . . . . 574
16.12 curses.textpad — Text input widget for curses programs . . . . . . . . . . . . . . . . . . . 590
16.13 curses.ascii — Utilities for ASCII characters . . . . . . . . . . . . . . . . . . . . . . . . . 591
16.14 curses.panel — A panel stack extension for curses . . . . . . . . . . . . . . . . . . . . . . 593
16.15 platform — Access to underlying platform’s identifying data . . . . . . . . . . . . . . . . . . 594
16.16 errno — Standard errno system symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597
16.17 ctypes — A foreign function library for Python . . . . . . . . . . . . . . . . . . . . . . . . . 603
17 Concurrent Execution 633
17.1 threading — Thread-based parallelism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633
17.2 multiprocessing — Process-based parallelism . . . . . . . . . . . . . . . . . . . . . . . . 644
17.3 The concurrent package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681
17.4 concurrent.futures — Launching parallel tasks . . . . . . . . . . . . . . . . . . . . . . . 682
17.5 subprocess — Subprocess management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 686
17.6 sched — Event scheduler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699
17.7 queue — A synchronized queue class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701
17.8 dummy_threading — Drop-in replacement for the threading module . . . . . . . . . . . 703
17.9 _thread — Low-level threading API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703
17.10 _dummy_thread — Drop-in replacement for the _thread module . . . . . . . . . . . . . . 705
18 Interprocess Communication and Networking 707
18.1 socket — Low-level networking interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
18.2 ssl — TLS/SSL wrapper for socket objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724
18.3 select — Waiting for I/O completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746
18.4 selectors – High-level I/O multiplexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 751
18.5 asyncio – Asynchronous I/O, event loop, coroutines and tasks . . . . . . . . . . . . . . . . . . 754
18.6 asyncore — Asynchronous socket handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791
18.7 asynchat — Asynchronous socket command/response handler . . . . . . . . . . . . . . . . . 794
18.8 signal — Set handlers for asynchronous events . . . . . . . . . . . . . . . . . . . . . . . . . 797
18.9 mmap — Memory-mapped file support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802
19 Internet Data Handling 807
19.1 email — An email and MIME handling package . . . . . . . . . . . . . . . . . . . . . . . . . 807
19.2 json — JSON encoder and decoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 857
19.3 mailcap — Mailcap file handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 864
19.4 mailbox — Manipulate mailboxes in various formats . . . . . . . . . . . . . . . . . . . . . . . 865
19.5 mimetypes — Map filenames to MIME types . . . . . . . . . . . . . . . . . . . . . . . . . . 880
19.6 base64 — Base16, Base32, Base64, Base85 Data Encodings . . . . . . . . . . . . . . . . . . . 883
19.7 binhex — Encode and decode binhex4 files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 886
19.8 binascii — Convert between binary and ASCII . . . . . . . . . . . . . . . . . . . . . . . . . 886
19.9 quopri — Encode and decode MIME quoted-printable data . . . . . . . . . . . . . . . . . . . 888
19.10 uu — Encode and decode uuencode files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 889
iii
剩余1625页未读,继续阅读
资源评论
lcjywc
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于jsp+mysql的JSP九宫格日记本源码.zip
- 基于jsp+mysql的JSP会员卡积分管理系统源码.zip
- 仿小米商城微信小程序源码+项目说明.zip
- 基于jsp+mysql的JSP个人日记本源码.zip
- 南溪CN No1 fps网络断网工具.zip
- 基于jsp+mysql的JSP宠物商城源码.zip
- C++开发基于Qt的音乐播放器的设计与实现项目源码+项目使用说明(毕业设计).zip
- 基于jsp+mysql+servlet的JSP图书馆图书管理系统源码.zip
- C++开发基于Qt的音乐播放器的设计与实现项目源码+项目使用说明(毕业设计).zip
- 【2024win11软件启动速度反应慢解决方法附工具】
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功