Python Cookbook(第三版·影印版)
Preface
1. Data Structures and Algorithms.
1.1. Unpacking a Sequence into Separate Variables
1.2. Unpacking Elements from Iterables of Arbitrary Length
1.3. Keeping the Last N Items
1.4. Finding the Largest or Smallest N Items
1.5. Implementing a Priority Queue
1.6. Mapping Keys to Multiple Values in a Dictionary
1.7. Keeping Dictionaries in Order
1.8. Calculating with Dictionaries
1.9. Finding Commonalities in Two Dictionaries
1.10. Removing Duplicates from a Sequence while Maintaining Order
1.11. Naming a Slice
1.12. Determining the Most Frequently Occurring Items in a Sequence
1.13. Sorting a List of Dictionaries by a Common Key
1.14. Sorting Objects With out Native Comparison Support
1.15. Grouping Records Together Based on a Field
1.16. Filtering Sequence Elements
1.17. Extracting a Subset of a Dictionary
1.18. Mapping Names to Sequence Elements
1.19. Transforming and Reducing Data at the Same Time
1.20. Combining Multiple Mappings into a Single Mapping
2. Strings and Text
2.1. Splitting Strings on Any of Multiple Delimiters
2.2. Matching Text at the Start or End of a String
2.3. Matching Strings Using Shell Wildcard Patterns
2.4. Matching and Searching for Text Patterns
2.5. Searching and Replacing Text
2.6. Searching and Replacing Case-Insensitive Text
2.7. Specifying a Regular Expression for the Shortest Match
2.8. Writing a Regular Expression for Multiline Patterns
2.9. Normalizing Unicode Text to a Standard Representation
2.10. Working with Unicode Characters in Regular Expressions
2.11. Stripping Unwanted Characters from Strings
2.12. Sanitizing and Cleaning Up Text
2.13. Aligning Text Strings
2.14. Combining and Concatenating Strings
2.15. Interpolating Variables in Strings
2.16. Reformatting Text to a Fixed Number of Columns
2.17. Handling HTML and XML Entities in Text
2.18. Tokenizing Text
2.19. Writing a Simple Recursive Descent Parser
2.20. Performing Text Operations on Byte Strings
3. Numbers, Dates, and Times
3.1. Rounding Numerical Values
3.2. Performing Accurate Decimal Calculations
3.3. Formatting Numbers for Output
3.4. Working with Binary, Octal, and Hexadecimal Integers
3.5. Packing and Unpacking Large Integers from Bytes
3.6. Performing Complex-Valued Math
3.7. Working with Infinity and NaNs
3.8. Calculating with Fractions
3.9. Calculating with Large Numerical Arrays
3.10. Performing Matrix and Linear Algebra Calculations
3.11. Picking Things at Random
3.12. Converting Days to Seconds, and Other Basic Time Conversions
3.13. Determining Last Friday's Date
3.14. Finding the Date Range for the Current Month
3.15. Converting Strings into Datetimes
3.16. Manipulating Dates Involving Time Zones
4. lterators and Generators.
4.1. Manually Consuming an Iterator
4.2. Delegating Iteration
4.3. Creating New Iteration Patterns with Generators
4.4. Implementing the Iterator Protocol
4.5. Iterating in Reverse
4.6. Defining Generator Functions with Extra State
……
5. Files and I/O
6. Data Encoding and Processing
7. Functions
8. Classes and Objects
9. Metaprogramming
10. Modulesand Packages
11. Network and Web Programming
12. Concurrency
13. Utility Scripting and System Administration
14. Testing, Debugging, and Exceptions
15. c Extensions
1. Data Structures and Algorithms.
1.1. Unpacking a Sequence into Separate Variables
1.2. Unpacking Elements from Iterables of Arbitrary Length
1.3. Keeping the Last N Items
1.4. Finding the Largest or Smallest N Items
1.5. Implementing a Priority Queue
1.6. Mapping Keys to Multiple Values in a Dictionary
1.7. Keeping Dictionaries in Order
1.8. Calculating with Dictionaries
1.9. Finding Commonalities in Two Dictionaries
1.10. Removing Duplicates from a Sequence while Maintaining Order
1.11. Naming a Slice
1.12. Determining the Most Frequently Occurring Items in a Sequence
1.13. Sorting a List of Dictionaries by a Common Key
1.14. Sorting Objects With out Native Comparison Support
1.15. Grouping Records Together Based on a Field
1.16. Filtering Sequence Elements
1.17. Extracting a Subset of a Dictionary
1.18. Mapping Names to Sequence Elements
1.19. Transforming and Reducing Data at the Same Time
1.20. Combining Multiple Mappings into a Single Mapping
2. Strings and Text
2.1. Splitting Strings on Any of Multiple Delimiters
2.2. Matching Text at the Start or End of a String
2.3. Matching Strings Using Shell Wildcard Patterns
2.4. Matching and Searching for Text Patterns
2.5. Searching and Replacing Text
2.6. Searching and Replacing Case-Insensitive Text
2.7. Specifying a Regular Expression for the Shortest Match
2.8. Writing a Regular Expression for Multiline Patterns
2.9. Normalizing Unicode Text to a Standard Representation
2.10. Working with Unicode Characters in Regular Expressions
2.11. Stripping Unwanted Characters from Strings
2.12. Sanitizing and Cleaning Up Text
2.13. Aligning Text Strings
2.14. Combining and Concatenating Strings
2.15. Interpolating Variables in Strings
2.16. Reformatting Text to a Fixed Number of Columns
2.17. Handling HTML and XML Entities in Text
2.18. Tokenizing Text
2.19. Writing a Simple Recursive Descent Parser
2.20. Performing Text Operations on Byte Strings
3. Numbers, Dates, and Times
3.1. Rounding Numerical Values
3.2. Performing Accurate Decimal Calculations
3.3. Formatting Numbers for Output
3.4. Working with Binary, Octal, and Hexadecimal Integers
3.5. Packing and Unpacking Large Integers from Bytes
3.6. Performing Complex-Valued Math
3.7. Working with Infinity and NaNs
3.8. Calculating with Fractions
3.9. Calculating with Large Numerical Arrays
3.10. Performing Matrix and Linear Algebra Calculations
3.11. Picking Things at Random
3.12. Converting Days to Seconds, and Other Basic Time Conversions
3.13. Determining Last Friday's Date
3.14. Finding the Date Range for the Current Month
3.15. Converting Strings into Datetimes
3.16. Manipulating Dates Involving Time Zones
4. lterators and Generators.
4.1. Manually Consuming an Iterator
4.2. Delegating Iteration
4.3. Creating New Iteration Patterns with Generators
4.4. Implementing the Iterator Protocol
4.5. Iterating in Reverse
4.6. Defining Generator Functions with Extra State
……
5. Files and I/O
6. Data Encoding and Processing
7. Functions
8. Classes and Objects
9. Metaprogramming
10. Modulesand Packages
11. Network and Web Programming
12. Concurrency
13. Utility Scripting and System Administration
14. Testing, Debugging, and Exceptions
15. c Extensions
比兹利(David Beazley),一名独立软件开发者。他为开发人员、科学家和工程师讲解编程课程。他是《Python Essential Reference》(Addison-Wesley出版社)的作者,并且创作了多个开源的Python包。
琼斯(Rrian K.Jones),普林斯顿大学计算机科学系的系统管理员。
琼斯(Rrian K.Jones),普林斯顿大学计算机科学系的系统管理员。
如果你需要一些帮助来编写基于Python 3的程序,或者想要更新老一些的Python 2代码,这本《Python Cookbook(第三版 影印版)》就是入场券。这本《Python Cookbook(第三版 影印版)》包含了用Python 3.3编写和测试过的实例,适合于那些希望专注于新工具和新方法的有经验的Python程序员。在这本《Python Cookbook(第三版 影印版)》里,你将找到十多个技术课题的完整实例,涵盖了核心Python语言和多种应用领域的常见任务。每种实例都包含了你可以直接使用在项目中的样例,以及关于这种解决方案如何和为什么可以奏效的讨论。
比价列表