python_3_standard_library_by_example

The Python 3 Standard Library by Example by Doug Hellmann

Return to Python Module Index,

Python Standard Library Modules List, Python 3 Module of the Week, Python Standard Library], Python Libraries, Python Official Glossary, Python Topics, Python, Python DevOps, Python DevSecOps - Python Security, Python NetDevOps, Python Data Science - Python DataOps, Python Machine Learning - Python MLOps, Cloud Native Python, Python Reserved Words, Awesome Python

Fair Use Source: B072QZZDV7

Return to Python bibliography, IT bibliography, Python Topics

Python 3 Standard Library by Example by Doug Hellmann

Master the Powerful Python 3 Standard Library through Real Code Examples

Introduction

“Distributed with every copy of Python, the Python standard library contains hundreds of Python modules that provide Python tools for interacting with the operating system, Python interpreter, and Python Internet — all of them tested and ready to be used to jump-start the Python development of your Python applications. This book presents selected Python examples demonstrating how to use the most commonly used Python features of the Python modules that support Python’s “batteries included” slogan, taken from the popular Python Module of the Week (PyMOTW) blog series.”

“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 Python 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

About the Author

Doug Hellmann is currently employed by Red Hat to work on OpenStack. He is on the OpenStack Technical Committee and contributes to many aspects of the project. 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. 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. Between 2007 and 2011, Doug published the popular “Python Module of the Week” series on his blog, and an earlier version of this book (for Python 2), The Python Standard Library By Example (Addison-Wesley, 2011) . He lives in Athens, Georgia.

Book Details

Introduction

“Distributed with every copy of Python, the Python standard library contains hundreds of Python modules that provide Python tools for interacting with the operating system, Python interpreter, and Internet — all of them Python tested and ready to be used to jump-start the Python development of your Python applications. This Python book presents selected Python examples demonstrating how to use the most commonly used Python features of the Python modules that support Python’s “batteries included” slogan, taken from the popular Python Module of the Week (PyMOTW) Python blog series.” Fair Use Source: B072QZZDV7

This Book’s Target Audience

The audience for this book consists of intermediate-level Python programmers. Thus, although all of the source code is presented with discussion, only a few cases include line-by-line explanations. Every section focuses on the features of the modules, illustrated by the source code and output from fully independent example programs. Each feature is presented as concisely as possible, so the reader can focus on the module or function being demonstrated without being distracted by the supporting code.

An experienced programmer who is familiar with other languages may be able to learn Python from this book, but the text is not intended to be an introduction to the language. Some prior experience writing Python programs will be useful when studying the examples.

Several sections, such as the description of network programming with sockets or hmac encryption, require domain-specific knowledge. The basic information needed to explain the examples is included here, but the range of topics covered by the modules in the standard library makes it impossible to cover every topic comprehensively in a single volume. The discussion of each module is followed by a list of suggested sources for more information and further reading, including online resources, RFC standards documents, and related books.“

Fair Use Source: B072QZZDV7

Contents at a Glance

Detailed Table of Contents

  • Introduction
  • Acknowledgments
  • About the Author

Chapter 1 - Text

Chapter 2 - Data Structures

Chapter 2 - Python Data Structures

Chapter 3 - Algorithms

Chapter 4 - Dates and Times

Chapter 5 - Mathematics

Chapter 6 - The File System

Chapter 6 - Python and the File System

Chapter 7 - Data Persistence and Exchange

Chapter 7 - Python Data Persistence and Exchange

Chapter 8 - Data Compression and Archiving

Chapter 8 - Python Data Compression and Archiving

Chapter 9 - Cryptography

Chapter 10 - Concurrency with Processes, Threads, and Coroutines

Chapter 10 - Python Concurrency with Processes, Threads, and Coroutines

Chapter 11 - Networking

Chapter 12 - The Internet

Chapter 12 - Python and The Internet

Chapter 13 - Email

Chapter 14 - Application Building Blocks

Chapter 14 - Python Application Building Blocks

Chapter 15 - Internationalization and Localization

Chapter 16 - Developer Tools

Chapter 16 - Python Developer Tools

Chapter 17 - Runtime Features

Chapter 17 - Python Runtime Features

Chapter 18 - Language Tools

Chapter 19 - Modules and Packages

Appendix A - Porting Notes

Appendix A - Python Porting Notes

Appendix B - Outside of the Standard Library

Index of Python Modules

How This Book Is Organized

“This book supplements the comprehensive reference guide (available at http://docs.python.org), providing fully functional example programs to demonstrate the features described there. The modules are grouped into chapters to make it easy to find an individual module for reference and browse by subject for more leisurely exploration. In the unlikely event that you want to read it through from cover to cover, it is organized to minimize “forward references” to modules not yet covered, although it was not possible to eliminate them entirely.”

Downloading the Example Code

The original versions of the articles and the sample code are available at https://pymotw.com/3/. Errata for the book can be found on the author’s website: https://doughellmann.com/blog/the-python-3-standard-library-by-example/.


Register

Register your copy of The Python 3 Standard Library by Example at informit.com for convenient access to downloads, updates, and corrections as they become available. To start the registration process, go to informit.com/register and log in or create an account. Enter the product ISBN (9780134291055) and click Submit. Once the process is complete, you will find any available bonus content under “Registered Products.”

Acknowledgments

“This book would not have come into being without the contributions and support of many other people.

I was first introduced to Python around 1997 by Dick Wall, while we were working together on GIS software at ERDAS. I remember being simultaneously happy that I had found a new tool language that was so easy to use, and sad that the company did not let us use it for “real work.” I have used Python extensively at all of my subsequent jobs, and I have Dick to thank for the many happy hours I have spent working on software since then.

The Python core development team has created a robust ecosystem of language, tools, and libraries that continue to grow in popularity and find new application areas. Without the continued investment in time and resources they have given us, we would all still be spending our energy reinventing wheel after wheel.

The material in this book started out as a series of blog posts. Without the exceptionally positive response of the readers of the blog, those articles would never have been updated to work with Python 3, and this new book would not exist. Each of those posts has been reviewed and commented on by members of the Python community, with corrections, suggestions, and questions that led to the refinements and improvements that appear in this book. Thank you all for reading along week after week, and contributing your time and attention.

The technical reviewers for the book—Diana Clarke, Ian Cordasco, Mark McClain, Paul McLanahan, and Ryan Petrello—spent many hours looking for issues with the example code and accompanying explanations. Thanks to their diligence, the resulting text is stronger than I could have produced on my own.

Jim Baker provided helpful insight when documenting the readline module, especially by pointing out the gnureadline package for platforms where GNU libraries are old or not installed by default.

Patrick Kettner helped to collect the output for the platform module examples on Windows.

A special thanks goes to the editors, production staff, and marketing team at Addison-Wesley for all of their hard work and assistance in helping me realize my vision for this book and make it a success.

Finally, I want to thank my wife, Theresa Flynn, who has gracefully accepted all of the lost nights and weekends over the course of this new project. Thank you for your advice, encouragement, and support.”

About the Author

Doug Hellmann is currently employed by Red Hat to work on OpenStack. He is on the OpenStack Technical Committee and contributes to many aspects of the project. He has been programming in Python since version Python 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. Doug is a Fellow of the Python Software Foundation, and served as its Communications Director from 2010 to 2012. After a year as a regular columnist for Python Magazine, he served as Editor-in-Chief from 2008 to 2009. Between 2007 and 2011, Doug published the popular Python Module of the Week series on his Python blog, and an earlier version of this book for Python 2 called The Python Standard Library by Example. He lives in Athens, Georgia.“ Fair Use Source: B072QZZDV7

Fair Use Sources

Python Standard Library:

Python Standard Library os Module, Python Standard Library sys Module, Python Standard Library datetime Module, Python Standard Library json Module, Python Standard Library logging Module, Python Standard Library re Module, Python Standard Library subprocess Module, Python Standard Library threading Module, Python Standard Library copy Module, Python Standard Library csv Module, Python Standard Library argparse Module, Python Standard Library math Module, Python Standard Library random Module, Python Standard Library collections Module, Python Standard Library io Module, Python Standard Library pickle Module, Python Standard Library base64 Module, Python Standard Library time Module, Python Standard Library calendar Module, Python Standard Library hashlib Module, Python Standard Library http Module, Python Standard Library socket Module, Python Standard Library ssl Module, Python Standard Library urllib Module, Python Standard Library xml Module, Python Standard Library email Module, Python Standard Library unittest Module, Python Standard Library pdb Module, Python Standard Library traceback Module, Python Standard Library multiprocessing Module, Python Standard Library concurrent.futures Module, Python Standard Library queue Module, Python Standard Library asyncio Module, Python Standard Library shutil Module, Python Standard Library tempfile Module, Python Standard Library glob Module, Python Standard Library fnmatch Module, Python Standard Library linecache Module, Python Standard Library operator Module, Python Standard Library pathlib Module, Python Standard Library fileinput Module, Python Standard Library stat Module, Python Standard Library filecmp Module, Python Standard Library mmap Module, Python Standard Library sqlite3 Module, Python Standard Library ftplib Module, Python Standard Library poplib Module, Python Standard Library smtplib Module, Python Standard Library telnetlib Module, Python Standard Library uuid Module, Python Standard Library bz2 Module, Python Standard Library gzip Module, Python Standard Library lzma Module, Python Standard Library zipfile Module, Python Standard Library configparser Module, Python Standard Library getopt Module, Python Standard Library argparse Module, Python Standard Library logging.config Module, Python Standard Library logging.handlers Module, Python Standard Library getpass Module, Python Standard Library curses Module, Python Standard Library platform Module, Python Standard Library errno Module, Python Standard Library ctypes Module, Python Standard Library struct Module, Python Standard Library binascii Module, Python Standard Library codecs Module, Python Standard Library dis Module, Python Standard Library imp Module, Python Standard Library importlib Module, Python Standard Library pkgutil Module, Python Standard Library inspect Module, Python Standard Library token Module, Python Standard Library ast Module, Python Standard Library symtable Module, Python Standard Library symbol Module, Python Standard Library tokenize Module, Python Standard Library keyword Module, Python Standard Library heapq Module, Python Standard Library bisect Module, Python Standard Library itertools Module, Python Standard Library functools Module, Python Standard Library operator Module, Python Standard Library contextlib Module, Python Standard Library weakref Module, Python Standard Library gc Module, Python Standard Library copyreg Module, Python Standard Library reprlib Module, Python Standard Library enum Module, Python Standard Library types Module, Python Standard Library decimal Module, Python Standard Library fractions Module, Python Standard Library random Module, Python Standard Library statistics Module, Python Standard Library math Module, Python Standard Library cmath

Python Standard Library Glossary, PEPs related to the Python Standard Library, Python Scripting, Python Keywords, Python Data Structures and the Python Standard Library - Python Algorithms and the Python Standard Library, Python OOP and the Python Standard Library - Python Design Patterns and the Python Standard Library, Python Module Index, pymotw.com;

Python DevOps Libraries - Python SRE Libraries, Python Data Science Libraries - Python DataOps Libraries, Python Machine Learning Libraries, Python Deep Learning Libraries, Functional Python Libraries, Python Concurrency Libraries - Python GIL Libraries - Python Async Libraries (Asyncio), Python Testing Libraries (Pytest), Python Frameworks Python Library Topics, Python GitHub Libraries, Python Awesome. (navbar_python_standard_library - see also navbar_python, navbar_python_libaries, navbar_python_virtual_environments, navbar_numpy, navbar_datascience)

Python: Python Variables, Python Data Types, Python Control Structures, Python Loops, Python Functions, Python Modules, Python Packages, Python File Handling, Python Errors and Exceptions, Python Classes and Objects, Python Inheritance, Python Polymorphism, Python Encapsulation, Python Abstraction, Python Lists, Python Dictionaries, Python Tuples, Python Sets, Python String Manipulation, Python Regular Expressions, Python Comprehensions, Python Lambda Functions, Python Map, Filter, and Reduce, Python Decorators, Python Generators, Python Context Managers, Python Concurrency with Threads, Python Asynchronous Programming, Python Multiprocessing, Python Networking, Python Database Interaction, Python Debugging, Python Testing and Unit Testing, Python Virtual Environments, Python Package Management, Python Data Analysis, Python Data Visualization, Python Web Scraping, Python Web Development with Flask/Django, Python API Interaction, Python GUI Programming, Python Game Development, Python Security and Cryptography, Python Blockchain Programming, Python Machine Learning, Python Deep Learning, Python Natural Language Processing, Python Computer Vision, Python Robotics, Python Scientific Computing, Python Data Engineering, Python Cloud Computing, Python DevOps Tools, Python Performance Optimization, Python Design Patterns, Python Type Hints, Python Version Control with Git, Python Documentation, Python Internationalization and Localization, Python Accessibility, Python Configurations and Environments, Python Continuous Integration/Continuous Deployment, Python Algorithm Design, Python Problem Solving, Python Code Readability, Python Software Architecture, Python Refactoring, Python Integration with Other Languages, Python Microservices Architecture, Python Serverless Computing, Python Big Data Analysis, Python Internet of Things (IoT), Python Geospatial Analysis, Python Quantum Computing, Python Bioinformatics, Python Ethical Hacking, Python Artificial Intelligence, Python Augmented Reality and Virtual Reality, Python Blockchain Applications, Python Chatbots, Python Voice Assistants, Python Edge Computing, Python Graph Algorithms, Python Social Network Analysis, Python Time Series Analysis, Python Image Processing, Python Audio Processing, Python Video Processing, Python 3D Programming, Python Parallel Computing, Python Event-Driven Programming, Python Reactive Programming.

Variables, Data Types, Control Structures, Loops, Functions, Modules, Packages, File Handling, Errors and Exceptions, Classes and Objects, Inheritance, Polymorphism, Encapsulation, Abstraction, Lists, Dictionaries, Tuples, Sets, String Manipulation, Regular Expressions, Comprehensions, Lambda Functions, Map, Filter, and Reduce, Decorators, Generators, Context Managers, Concurrency with Threads, Asynchronous Programming, Multiprocessing, Networking, Database Interaction, Debugging, Testing and Unit Testing, Virtual Environments, Package Management, Data Analysis, Data Visualization, Web Scraping, Web Development with Flask/Django, API Interaction, GUI Programming, Game Development, Security and Cryptography, Blockchain Programming, Machine Learning, Deep Learning, Natural Language Processing, Computer Vision, Robotics, Scientific Computing, Data Engineering, Cloud Computing, DevOps Tools, Performance Optimization, Design Patterns, Type Hints, Version Control with Git, Documentation, Internationalization and Localization, Accessibility, Configurations and Environments, Continuous Integration/Continuous Deployment, Algorithm Design, Problem Solving, Code Readability, Software Architecture, Refactoring, Integration with Other Languages, Microservices Architecture, Serverless Computing, Big Data Analysis, Internet of Things (IoT), Geospatial Analysis, Quantum Computing, Bioinformatics, Ethical Hacking, Artificial Intelligence, Augmented Reality and Virtual Reality, Blockchain Applications, Chatbots, Voice Assistants, Edge Computing, Graph Algorithms, Social Network Analysis, Time Series Analysis, Image Processing, Audio Processing, Video Processing, 3D Programming, Parallel Computing, Event-Driven Programming, Reactive Programming.


Python Glossary, Python Fundamentals, Python Inventor: Python Language Designer: Guido van Rossum on 20 February 1991; PEPs, Python Scripting, Python Keywords, Python Built-In Data Types, Python Data Structures - Python Algorithms, Python Syntax, Python OOP - Python Design Patterns, Python Module Index, pymotw.com, Python Package Manager (pip-PyPI), Python Virtualization (Conda, Miniconda, Virtualenv, Pipenv, Poetry), Python Interpreter, CPython, Python REPL, Python IDEs (PyCharm, Jupyter Notebook), Python Development Tools, Python Linter, Pythonista-Python User, Python Uses, List of Python Software, Python Popularity, Python Compiler, Python Transpiler, Python DevOps - Python SRE, Python Data Science - Python DataOps, Python Machine Learning, Python Deep Learning, Functional Python, Python Concurrency - Python GIL - Python Async (Asyncio), Python Standard Library, Python Testing (Pytest), Python Libraries (Flask), Python Frameworks (Django), Python History, Python Bibliography, Manning Python Series, Python Official Glossary - Python Glossary, Python Topics, Python Courses, Python Research, Python GitHub, Written in Python, Python Awesome List, Python Versions. (navbar_python - see also navbar_python_libaries, navbar_python_standard_library, navbar_python_virtual_environments, navbar_numpy, navbar_datascience)


Cloud Monk is Retired (for now). Buddha with you. © 2005 - 2024 Losang Jinpa or Fair Use. Disclaimers

SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.


python_3_standard_library_by_example.txt · Last modified: 2024/03/14 18:42 by 127.0.0.1