Book description
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
Table of contents
- Cover Page
- About This E-Book
- Title Page
- Copyright Page
- Dedication Page
- Contents at a Glance
- Contents
- Introduction
- Acknowledgments
- About the Author
- Chapter 1. Text
-
Chapter 2. Data Structures
- 2.1 enum: Enumeration Type
- 2.2 collections: Container Data Types
- 2.3 array: Sequence of Fixed-Type Data
- 2.4 heapq: Heap Sort Algorithm
- 2.5 bisect: Maintain Lists in Sorted Order
- 2.6 queue: Thread-Safe FIFO Implementation
- 2.7 struct: Binary Data Structures
- 2.8 weakref: Impermanent References to Objects
- 2.9 copy: Duplicate Objects
- 2.10 pprint: Pretty-Print Data Structures
- Chapter 3. Algorithms
- Chapter 4. Dates and Times
- Chapter 5. Mathematics
-
Chapter 6. The File System
- 6.1 os.path: Platform-Independent Manipulation of Filenames
- 6.2 pathlib: File System Paths as Objects
- 6.3 glob: Filename Pattern Matching
- 6.4 fnmatch: Unix-Style Glob Pattern Matching
- 6.5 linecache: Read Text Files Efficiently
- 6.6 tempfile: Temporary File System Objects
- 6.7 shutil: High-Level File Operations
- 6.8 filecmp: Compare Files
- 6.9 mmap: Memory-Map Files
- 6.10 codecs: String Encoding and Decoding
- 6.11 io: Text, Binary, and Raw Stream I/O Tools
- Chapter 7. Data Persistence and Exchange
- Chapter 8. Data Compression and Archiving
- Chapter 9. Cryptography
-
Chapter 10. Concurrency with Processes, Threads, and Coroutines
- 10.1 subprocess: Spawning Additional Processes
- 10.2 signal: Asynchronous System Events
- 10.3 threading: Manage Concurrent Operations Within a Process
- 10.4 multiprocessing: Manage Processes Like Threads
- 10.5 asyncio: Asynchronous I/O, Event Loop, and Concurrency Tools
- 10.6 concurrent.futures: Manage Pools of Concurrent Tasks
- Chapter 11. Networking
-
Chapter 12. The Internet
- 12.1 urllib.parse: Split URLs into Components
- 12.2 urllib.request: Network Resource Access
- 12.3 urllib.robotparser: Internet Spider Access Control
- 12.4 base64: Encode Binary Data with ASCII
- 12.5 http.server: Base Classes for Implementing Web Servers
- 12.6 http.cookies: HTTP Cookies
- 12.7 webbrowser: Displays Web Pages
- 12.8 uuid: Universally Unique Identifiers
- 12.9 json: JavaScript Object Notation
- 12.10 xmlrpc.client: Client Library for XML-RPC
- 12.11 xmlrpc.server: An XML-RPC Server
- Chapter 13. Email
-
Chapter 14. Application Building Blocks
- 14.1 argparse: Command-Line Option and Argument Parsing
- 14.2 getopt: Command-Line Option Parsing
- 14.3 readline: The GNU readline Library
- 14.4 getpass: Secure Password Prompt
- 14.5 cmd: Line-Oriented Command Processors
- 14.6 shlex: Parse Shell-Style Syntaxes
- 14.7 configparser: Work with Configuration Files
- 14.8 logging: Report Status, Error, and Informational Messages
- 14.9 fileinput: Command-Line Filter Framework
- 14.10 atexit: Program Shutdown Callbacks
- 14.11 sched: Timed Event Scheduler
- Chapter 15. Internationalization and Localization
-
Chapter 16. Developer Tools
- 16.1 pydoc: Online Help for Modules
- 16.2 doctest: Testing Through Documentation
- 16.3 unittest: Automated Testing Framework
- 16.4 trace: Follow Program Flow
- 16.5 traceback: Exceptions and Stack Traces
- 16.6 cgitb: Detailed Traceback Reports
- 16.7 pdb: Interactive Debugger
- 16.8 profile and pstats: Performance Analysis
- 16.9 timeit: Time the Execution of Small Bits of Python Code
- 16.10 tabnanny: Indentation Validator
- 16.11 compileall: Byte-Compile Source Files
- 16.12 pyclbr: Class Browser
- 16.13 venv: Create Virtual Environments
- 16.14 ensurepip: Install the Python Package Installer
-
Chapter 17. Runtime Features
- 17.1 site: Site-Wide Configuration
- 17.2 sys: System-Specific Configuration
- 17.3 os: Portable Access to Operating System–Specific Features
- 17.4 platform: System Version Information
- 17.5 resource: System Resource Management
- 17.6 gc: Garbage Collector
- 17.7 sysconfig: Interpreter Compile-Time Configuration
- Chapter 18. Language Tools
- Chapter 19. Modules and Packages
- Appendix A. Porting Notes
- Appendix B. Outside of the Standard Library
- Index of Python Modules
- Index
- Code Snippets
Product information
- Title: The Python 3 Standard Library by Example, Second Edition
- Author(s):
- Release date: June 2017
- Publisher(s): Addison-Wesley Professional
- ISBN: 9780134291154
You might also like
book
Modern Python Cookbook - Second Edition
Complete recipes spread across 15 chapters to help you overcome commonly faced issues by Python for …
book
Python 3 Object-Oriented Programming. - Third Edition
Uncover modern Python with this guide to Python data structures, design patterns, and effective object-oriented techniques …
book
Advanced Python Programming - Second Edition
Write fast, robust, and highly reusable applications using Python's internal optimization, state-of-the-art performance-benchmarking tools, and cutting-edge …
book
Mastering Python - Second Edition
Use advanced features of Python to write high-quality, readable code and packages Key Features Extensively updated …