Build optimized applications in Python by smartly implementing the standard library Key Features Strategic recipes for effective application development in Python Techniques to create GUIs and implement security through cryptography Best practices for developing readily scalable, production-ready applications Book Description The Python 3 Standard Library is a vast array of modules that you can use for developing various kinds of applications. It contains an exhaustive list of libraries, and this book will help you choose the best one to address specific programming problems in Python. The Modern Python Standard Library Cookbook begins with recipes on containers and data structures and guides you in performing effective text management in Python. You will find Python recipes for command-line operations, networking, filesystems and directories, and concurrent execution. You will learn about Python security essentials in Python and get to grips with various development tools for debugging, benchmarking, inspection, error reporting, and tracing. The book includes recipes to help you create graphical user interfaces for your application. You will learn to work with multimedia components and perform mathematical operations on date and time. The recipes will also show you how to deploy different searching and sorting algorithms on your data. By the end of the book, you will have acquired the skills needed to write clean code in Python and develop applications that meet your needs. What you will learn Store multiple values per key in associative containers Create interactive character-based user interfaces Work with native time and display data for your time zone Read/write SGML family languages, both as a SAX and DOM parser to meet file sizes and other requirements Group equivalent items using itertools and sorted features together Use partials to create unary functions out of multi-argument functions Implement hashing algorithms to store passwords in a safe way Who this book is for If you are a developer who wants to write highly responsive, manageable, scalable, and resilient code in Python, this book is for you. Prior programming knowledge in Python will help you make the most out of the book.
Author(s): Alessandro Molina
Year: 2018
Language: English
Pages: 366
Title Page
Copyright and Credits
Modern Python Standard Library Cookbook
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Get in touch
Reviews
Containers and Data Structures
Introduction
Counting frequencies
How to do it...
How it works...
There's more...
Dictionary with fallback
How to do it...
How it works...
There's more...
Unpacking multiple keyword arguments
How to do it...
How it works...
There's more...
Ordered dictionaries
How to do it...
How it works...
There's more...
MultiDict
How to do it...
How it works...
There's more...
Prioritizing entries
How to do it...
How it works...
There's more...
Bunch
How to do it...
How it works...
There's more...
Enumerations
How to do it...
How it works...
There's more...
Text Management
Introduction
Pattern matching
How to do it...
There's more...
Text similarity
How to do it...
There's more...
Text suggestion
How to do it...
Templating
How to do it...
How it works...
There's more...
Splitting strings and preserving spaces
How to do it...
How it works...
Cleanup text
How to do it...
How it works...
Normalizing text
How to do it...
How it works...
Aligning text
How to do it...
How it works...
Command Line
Introduction
Basic logging
How to do it...
How it works...
There's more...
Logging to file
How to do it...
How it works...
Logging to Syslog
Getting ready
How to do it...
There's more...
Parsing arguments
How to do it...
How it works...
There's more...
Interactive shells
How to do it...
How it works...
Sizing terminal text
How to do it...
How it works...
Running system commands
How to do it...
How it works...
There's more...
Progress bar
How to do it...
How it works...
Message boxes
Getting ready
How to do it...
How it works...
Input box
Getting ready
How to do it...
How it works...
Filesystem and Directories
Introduction
Traversing folders
How to do it...
How it works...
Working with paths
How to do it...
There's more...
Expanding filenames
How to do it...
Getting file information
How to do it...
Named temporary files
How to do it...
Memory and disk buffer
How to do it...
How it works...
Managing filename encoding
How to do it...
How it works...
Copying a directory
How to do it...
How it works...
Safely replacing file's content
How to do it...
How it works...
Date and Time
Introduction
Time-zone-aware datetime
How to do it...
How it works...
There's more...
Parsing dates
How to do it...
How it works...
There's more...
Saving dates
How to do it...
How it works...
From timestamps to datetimes
How to do it...
There's more...
Displaying dates in user format
How to do it...
How it works...
There's more...
Going to tomorrow
How to do it...
How it works...
Going to next month
How to do it...
How it works...
Weekdays
How to do it...
How it works...
Workdays
How to do it...
How it works...
Combining dates and times
How to do it...
There's more...
Read/Write Data
Introduction
Reading and writing text data
How to do it...
How it works...
There's more...
Reading lines of text
How to do it...
How it works...
Reading and writing binary data
How to do it...
How it works...
There's more...
Zipping a directory
How to do it...
How it works...
Pickling and shelving
How to do it...
How it works...
There's more...
Reading configuration files
How to do it...
How it works...
There's more...
Writing XML/HTML content
How to do it...
How it works...
There's more...
Reading XML/HTML content
How to do it...
How it works...
There's more...
Reading and writing CSV
How to do it...
There's more...
Reading/writing a database
How to do it...
How it works...
There's more...
Algorithms
Introduction
Searching, sorting, filtering
How to do it...
How it works...
There's more...
Getting the nth element of any iterable
How to do it...
How it works...
Grouping similar items
How to do it...
How it works...
Zipping
How to do it...
How it works...
Flattening a list of lists
How to do it...
How it works...
There's more...
Producing permutations and combinations
How to do it...
Accumulating and reducing
How to do it...
There's more...
Memoizing
How to do it...
How it works...
Operators to functions
How to do it...
How it works...
Partials
How to do it...
How it works...
Generic functions
How to do it...
How it works...
Proper decoration
How to do it...
There's more...
Context managers
How to do it...
Applying variable context managers
How to do it...
Cryptography
Introduction
Asking for passwords
How to do it...
How it works...
Hashing passwords
How to do it...
How it works...
Verifying a file's integrity
How to do it...
How it works...
Verifying a message's integrity
How to do it...
How it works...
Concurrency
Introduction
ThreadPools
How to do it...
How it works...
There's more...
Coroutines
How to do it...
How it works...
There's more...
Processes
How to do it...
How it works...
There's more...
Futures
How to do it...
How it works...
There's more...
Scheduled tasks
How to do it...
How it works...
Sharing data between processes
How to do it...
How it works...
There's more...
Networking
Introduction
Sending emails
How to do it...
How it works...
Fetching emails
How to do it...
How it works...
There's more...
FTP
How to do it...
How it works...
There's more...
Sockets
How to do it...
How it works...
AsyncIO
How to do it...
How it works...
Remote procedure calls
How to do it...
How it works...
There's more...
Web Development
Introduction
Treating JSON
How to do it...
How it works...
There's more...
Parsing URLs
How to do it...
There's more...
Consuming HTTP
How to do it...
How it works...
There's more...
Submitting forms to HTTP
How to do it...
How it works...
There's more...
Building HTML
How to do it...
How it works...
Serving HTTP
How to do it...
How it works...
There's more...
Serving static files
How to do it...
How it works...
There's more...
Errors in web applications
How to do it...
How it works...
There's more...
Handling forms and files
How to do it...
How it works...
REST API
How to do it...
How it works...
Handling cookies
How to do it...
How it works...
There's more...
Multimedia
Introduction
Determining the type of a file
How to do it...
How it works...
Detecting image types
How to do it...
How it works...
There's more...
Detecting image sizes
How to do it...
How it works...
Playing audio/video/images
How to do it...
How it works...
Graphical User Interfaces
Introduction
Alerts
How to do it...
How it works...
Dialog boxes
How to do it...
How it works...
ProgressBar dialog
How to do it...
How it works...
Lists
How to do it...
How it works...
Menus
How to do it...
How it works...
Development Tools
Introduction
Debugging
How to do it...
How it works...
There's more...
Testing
How to do it...
How it works...
There's more...
Mocking
How it works...
How it works...
There's more...
Reporting errors in production
How to do it...
How it works...
Benchmarking
How to do it...
There's more...
Inspection
How to do it...
How it works...
There's more...
Code evaluation
How to do it...
Tracing code
How to do it...
How it works...
There's more...
Profiling
How to do it...
How it works...
Other Books You May Enjoy
Leave a review - let other readers know what you think