Description
Master the Powerful Python 3 Standard Library through Real Code Examples
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.
Key Features
- 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
Review
“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
Table of Contents
- Cover Page
- About This E-Book
- Title Page
- Copyright Page
- Dedication Page
- Contents at a Glance
- Contents
- Introduction
- This Book’s Target Audience
- Python 3 Versus 2
- How This Book Is Organized
- Downloading the Example Code
- Acknowledgments
- About the Author
- Chapter 1. Text
- string: Text Constants and Templates
- textwrap: Formatting Text Paragraphs
- re: Regular Expressions
- difflib: Compare Sequences
- Chapter 2. Data Structures
- enum: Enumeration Type
- collections: Container Data Types
- array: Sequence of Fixed-Type Data
- heapq: Heap Sort Algorithm
- bisect: Maintain Lists in Sorted Order
- queue: Thread-Safe FIFO Implementation
- struct: Binary Data Structures
- weakref: Impermanent References to Objects
- copy: Duplicate Objects
- pprint: Pretty-Print Data Structures
- Chapter 3. Algorithms
- functools: Tools for Manipulating Functions
- itertools: Iterator Functions
- operator: Functional Interface to Built-In Operators
- contextlib: Context Manager Utilities
- Chapter 4. Dates and Times
- time: Clock Time
- datetime: Date and Time Value Manipulation
- calendar: Work with Dates
- Chapter 5. Mathematics
- decimal: Fixed- and Floating-Point Math
- fractions: Rational Numbers
- random: Pseudorandom Number Generators
- math: Mathematical Functions
- statistics: Statistical Calculations
- Chapter 6. The File System
- os.path: Platform-Independent Manipulation of Filenames
- pathlib: File System Paths as Objects
- glob: Filename Pattern Matching
- fnmatch: Unix-Style Glob Pattern Matching
- linecache: Read Text Files Efficiently
- tempfile: Temporary File System Objects
- shutil: High-Level File Operations
- filecmp: Compare Files
- mmap: Memory-Map Files
- codecs: String Encoding and Decoding
- io: Text, Binary, and Raw Stream I/O Tools
- Chapter 7. Data Persistence and Exchange
- pickle: Object Serialization
- shelve: Persistent Storage of Objects
- dbm: Unix Key-Value Databases
- sqlite3: Embedded Relational Database
- xml.etree.ElementTree: XML Manipulation API
- csv: Comma-Separated Value Files
- Chapter 8. Data Compression and Archiving
- zlib: GNU zlib Compression
- gzip: Read and Write GNU zip Files
- bz2: bzip2 Compression
- tarfile: Tar Archive Access
- zipfile: ZIP Archive Access
- Chapter 9. Cryptography
- hashlib: Cryptographic Hashing
- hmac: Cryptographic Message Signing and Verification
- Chapter 10. Concurrency with Processes, Threads, and Coroutines
- subprocess: Spawning Additional Processes
- signal: Asynchronous System Events
- threading: Manage Concurrent Operations Within a Process
- multiprocessing: Manage Processes Like Threads
- asyncio: Asynchronous I/O, Event Loop, and Concurrency Tools
- concurrent.futures: Manage Pools of Concurrent Tasks
- Chapter 11. Networking
- ipaddress: Internet Addresses
- socket: Network Communication
- selectors: I/O Multiplexing Abstractions
- select: Wait for I/O Efficiently
- socketserver: Creating Network Servers
- Chapter 12. The Internet
- urllib.parse: Split URLs into Components
- urllib.request: Network Resource Access
- urllib.robotparser: Internet Spider Access Control
- base64: Encode Binary Data with ASCII
- http.server: Base Classes for Implementing Web Servers
- http.cookies: HTTP Cookies
- webbrowser: Displays Web Pages
- uuid: Universally Unique Identifiers
- json: JavaScript Object Notation
- xmlrpc.client: Client Library for XML-RPC
- xmlrpc.server: An XML-RPC Server
- Chapter 13. Email
- smtplib: Simple Mail Transfer Protocol Client
- smtpd: Sample Mail Servers
- mailbox: Manipulate Email Archives
- imaplib: IMAP4 Client Library
- Chapter 14. Application Building Blocks
- argparse: Command-Line Option and Argument Parsing
- getopt: Command-Line Option Parsing
- readline: The GNU readline Library
- getpass: Secure Password Prompt
- cmd: Line-Oriented Command Processors
- shlex: Parse Shell-Style Syntaxes
- configparser: Work with Configuration Files
- logging: Report Status, Error, and Informational Messages
- fileinput: Command-Line Filter Framework
- atexit: Program Shutdown Callbacks
- sched: Timed Event Scheduler
- Chapter 15. Internationalization and Localization
- gettext: Message Catalogs
- locale: Cultural Localization API
- Chapter 16. Developer Tools
- pydoc: Online Help for Modules
- doctest: Testing Through Documentation
- unittest: Automated Testing Framework
- trace: Follow Program Flow
- traceback: Exceptions and Stack Traces
- cgitb: Detailed Traceback Reports
- pdb: Interactive Debugger
- profile and pstats: Performance Analysis
- timeit: Time the Execution of Small Bits of Python Code
- tabnanny: Indentation Validator
- compileall: Byte-Compile Source Files
- pyclbr: Class Browser
- venv: Create Virtual Environments
- ensurepip: Install the Python Package Installer
- Chapter 17. Runtime Features
- site: Site-Wide Configuration
- sys: System-Specific Configuration
- os: Portable Access to Operating System–Specific Features
- platform: System Version Information
- resource: System Resource Management
- gc: Garbage Collector
- sysconfig: Interpreter Compile-Time Configuration
- Chapter 18. Language Tools
- warnings: Non-fatal Alerts
- abc: Abstract Base Classes
- dis: Python Byte-Code Disassembler
- inspect: Inspect Live Objects
- Chapter 19. Modules and Packages
- importlib: Python’s Import Mechanism
- pkgutil: Package Utilities
- zipimport: Load Python Code from ZIP Archives
- Appendix A. Porting Notes
- A.1 References
- A.2 New Modules
- A.3 Renamed Modules
- A.4 Removed Modules
- A.5 Deprecated Modules
- A.6 Summary of Changes to Modules
- Appendix B. Outside of the Standard Library
- B.1 Text
- B.2 Algorithms
- B.3 Dates and Times
- B.4 Mathematics
- B.5 Data Persistence and Exchange
- B.6 Cryptography
- B.7 Concurrency with Processes, Threads, and Coroutines
- B.8 The Internet
- B.9 Email
- B.10 Application Building Blocks
- B.11 Developer Tools
- Index of Python Modules
- Index
- Code Snippets
Author Biography
Doug Hellmann is a Senior Principal Software Engineer at Red Hat, working on OpenStack. He has been programming in Python since version 1.4, and has worked on a variety of Unix and non-Unix platforms for projects in fields such as mapping, medical news publishing, banking, and data center automation. In addition to his involvement with the OpenStack community, Doug is a Fellow of the Python Software Foundation, and served as its Communications Director from 2010-2012. After a year as a regular columnist for Python Magazine, he served as Editor-in-Chief from 2008-2009. Doug published the popular “Python Module of the Week” series on his blog. He lives in Athens, Georgia, USA with his wife and cats.
Additional information
| Weight | 1.696 kg |
|---|
Only logged in customers who have purchased this product may leave a review.
Related Products








Reviews
There are no reviews yet.