
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