Example: bachelor of science

THIRD EDITION Python Cookbook - Dabeaz LLC

David Beazley and Brian K. JonesTHIRD EDITIONP ython CookbookTable of ContentsPreface.. Structures & Algorithms.. Unpacking a Sequence Into Separate Variables Unpacking Elements From Iterables of Arbitrary Length Keeping the Last N Items Finding the Largest or Smallest N Items Implementing a Priority Queue How to Map Keys to Multiple Values in a Dictionary Keeping Dictionaries in Order

4.7. Taking a Slice of an Iterator 122 4.8. Skipping the First Part of an Iterable 123

Tags:

  Python, Edition, Third, Cookbook, Third edition python cookbook

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of THIRD EDITION Python Cookbook - Dabeaz LLC

1 David Beazley and Brian K. JonesTHIRD EDITIONP ython CookbookTable of ContentsPreface.. Structures & Algorithms.. Unpacking a Sequence Into Separate Variables Unpacking Elements From Iterables of Arbitrary Length Keeping the Last N Items Finding the Largest or Smallest N Items Implementing a Priority Queue How to Map Keys to Multiple Values in a Dictionary Keeping Dictionaries in Order

2 Calculating With Dictionaries Finding Out What Two Dictionaries Have in Common Removing Duplicates From A Sequence While Maintaining Order Naming a Slice Determining the Most Frequently Occurring Items in a Sequence Sort a List of Dictionaries by a Common Key Sort Objects Without Native Comparison Support Grouping Records Together Based on a Field Filtering Sequence Elements Extracting a Subset of a Dictionary Mapping Names to Sequence Elements Transforming and Reducing Data at the Same Time Working with Multiple Mappings as a Single Mapping and Text.

3 Splitting Strings On Any of Multiple Delimiters Matching Text at the Start or End of String Matching Strings Using Shell Wildcard Patterns Matching and Searching for Text Patterns Searching and Replacing Text Case-Insensitive Search and Replace Specifying a Regular Expression for the Shortest Match Writing a Regular Expression For Multiline Patterns Normalizing Unicode Text to a Standard Representation Working with Unicode Characters in Regular Expressions Stripping Unwanted Characters From Strings Sanitizing and Cleaning up Text Aligning Text Strings Combining and Concatenating

4 Strings Variable Interpolation in Strings Reformatting Text to Fixed Number of Columns Handling HTML and XML Entities in Text Tokenizing Text Writing a Simple Recursive Descent Parser Performing Text Operations on Byte Strings , Dates and Times.

5 Rounding Numerical Values Accurate Decimal Calculations Formatting Numbers for Output Binary, Octal, and Hexadecimal Integers Packing and Unpacking Large Integers From Bytes Complex Valued Math Infinity and NaNs Calculating with Fractions Calculating with Large Numerical Arrays Matrices and Linear Algebra

6 Picking Things at Random Convert Days to Seconds, and Other Basic Time Conversions Determining Last Friday s Date Finding the Date Range For the Current Month Converting Strings Into Datetimes Date Manipulation Involving Timezones and Generators.

7 Manually Consuming an Iterator Delegating Iteration Creating New Iteration Patterns With Generators Easy Implementation of the Iterator Protocol Iterating in Reverse Generator Functions With Extra State 120iv | Table of Taking a Slice of an Iterator Skipping the First Part of an Iterable Combinations and Permutations Iterate Over the Index-Value Pairs of a Sequence Iterating Over Multiple Sequences at Once Iterating on Items in Separate Containers Creating Data Processing Pipelines

8 How to Flatten a Nested Sequence Iterating in Sorted Order Over Merged Sorted Iterables Replacing Infinite While-Loops with an Iterator and I/O.. Reading and Writing Text Data Printing to a File Printing With a Different Separator or Line Ending Reading and Writing Binary Data Writing to a File That Doesn t Already Exist Performing I/O Operations on a String Reading and Writing Compressed Data

9 Files Iterating Over Fixed-Sized Records Reading Binary Data into a Mutable Buffer Memory Mapped Files Manipulating Pathnames Testing for the Existence of a File Getting a Directory Listing Bypassing Filename Encoding Printing Bad Filenames Adding or Changing the Encoding of an Already Open File Writing Bytes to a Text File Wrapping an Existing File Descriptor as a File Object Making Temporary Files and Directories Communicating with Serial Ports

10 Serializing Python Objects Encoding and Processing.. Reading and Writing CSV Data Reading and Writing JSON Data Parsing Simple XML Data Incr


Related search queries