You are here: Home > Dive Into Python > List of examples | << >> | ||||
Dive Into PythonPython from novice to pro |
- 1.3. Python on Mac OS X
- 1.5. Python on RedHat Linux
- 1.6. Python on Debian GNU/Linux
- 1.7. Python Installation from Source
- 1.8. The Interactive Shell
Chapter 2. Your First Python Program
- 2.1. Diving in
- 2.3. Documenting Functions
- 2.4. Everything Is an Object
- 2.4.1. The Import Search Path
- 2.5. Indenting Code
- 3.1.1. Defining Dictionaries
- 3.1.2. Modifying Dictionaries
- 3.1.3. Deleting Items From Dictionaries
- 3.2.1. Defining Lists
- 3.2.2. Adding Elements to Lists
- 3.2.3. Searching Lists
- 3.2.4. Deleting List Elements
- 3.2.5. Using List Operators
- 3.3. Introducing Tuples
- 3.4. Declaring variables
- 3.4.1. Referencing Variables
- 3.4.2. Assigning Multiple Values at Once
- 3.5. Formatting Strings
- 3.6. Mapping Lists
- 3.7. Joining Lists and Splitting Strings
Chapter 4. The Power Of Introspection
- 4.1. Diving In
- 4.2. Using Optional and Named Arguments
- 4.3.1. The type Function
- 4.3.2. The str Function
- 4.3.3. Built-In Functions
- 4.4. Getting Object References With getattr
- 4.4.1. getattr with Modules
- 4.4.2. getattr As a Dispatcher
- 4.5. Filtering Lists
- 4.6. The Peculiar Nature of and and or
- 4.6.1. Using the and-or Trick
- 4.7. Using lambda Functions
- 4.7.1. Real-World lambda Functions
- 4.8. Putting It All Together
Chapter 5. Objects and Object-Orientation
- 5.1. Diving In
- 5.2. Importing Modules Using from module import
- 5.3. Defining Classes
- 5.3.1. Initializing and Coding Classes
- 5.4. Instantiating Classes
- 5.4.1. Garbage Collection
- 5.5. Exploring UserDict: A Wrapper Class
- 5.6.1. Getting and Setting Items
- 5.7. Advanced Special Class Methods
- 5.8. Introducing Class Attributes
- 5.9. Private Functions
Chapter 6. Exceptions and File Handling
- 6.1. Handling Exceptions
- 6.1.1. Using Exceptions For Other Purposes
- 6.2. Working with File Objects
- 6.2.1. Reading Files
- 6.2.2. Closing Files
- 6.2.3. Handling I/O Errors
- 6.2.4. Writing to Files
- 6.3. Iterating with for Loops
- 6.4. Using sys.modules
- 6.5. Working with Directories
- 6.6. Putting It All Together
Chapter 7. Regular Expressions
- 7.2. Case Study: Street Addresses
- 7.3.1. Checking for Thousands
- 7.3.2. Checking for Hundreds
- 7.4. Using the {n,m} Syntax
- 7.4.1. Checking for Tens and Ones
- 7.5. Verbose Regular Expressions
- 7.6. Case study: Parsing Phone Numbers
- Example 7.10. Finding Numbers
- Example 7.11. Finding the Extension
- Example 7.12. Handling Different Separators
- Example 7.13. Handling Numbers Without Separators
- Example 7.14. Handling Leading Characters
- Example 7.15. Phone Number, Wherever I May Find Ye
- Example 7.16. Parsing Phone Numbers (Final Version)
- 8.1. Diving in
- 8.2. Introducing sgmllib.py
- 8.3. Extracting data from HTML documents
- 8.4. Introducing BaseHTMLProcessor.py
- 8.5. locals and globals
- 8.6. Dictionary-based string formatting
- 8.7. Quoting attribute values
- 8.8. Introducing dialect.py
- 8.9. Putting it all together
- 9.1. Diving in
- 9.2. Packages
- 9.3. Parsing XML
- 9.4. Unicode
- 9.5. Searching for elements
- 9.6. Accessing element attributes
Chapter 10. Scripts and Streams
- 10.1. Abstracting input sources
- Example 10.1. Parsing XML from a file
- Example 10.2. Parsing XML from a URL
- Example 10.3. Parsing XML from a string (the easy but inflexible way)
- Example 10.4. Introducing StringIO
- Example 10.5. Parsing XML from a string (the file-like object way)
- Example 10.6. openAnything
- Example 10.7. Using openAnything in kgp.py
- 10.2. Standard input, output, and error
- 10.3. Caching node lookups
- 10.4. Finding direct children of a node
- 10.5. Creating separate handlers by node type
- 10.6. Handling command-line arguments
- 11.1. Diving in
- 11.2. How not to fetch data over HTTP
- 11.4. Debugging HTTP web services
- 11.5. Setting the User-Agent
- 11.6. Handling Last-Modified and ETag
- 11.7. Handling redirects
- 11.8. Handling compressed data
- 11.9. Putting it all together
- 12.1. Diving In
- 12.2.1. Installing PyXML
- 12.2.2. Installing fpconst
- 12.2.3. Installing SOAPpy
- 12.3. First Steps with SOAP
- 12.4. Debugging SOAP Web Services
- 12.6. Introspecting SOAP Web Services with WSDL
- 12.7. Searching Google
- 12.8. Troubleshooting SOAP Web Services
- 13.3. Introducing romantest.py
- 13.4. Testing for success
- 13.5. Testing for failure
- 13.6. Testing for sanity
Chapter 14. Test-First Programming
- 14.1. roman.py, stage 1
- 14.2. roman.py, stage 2
- 14.3. roman.py, stage 3
- 14.4. roman.py, stage 4
- 14.5. roman.py, stage 5
- 15.1. Handling bugs
- 15.2. Handling changing requirements
- 15.3. Refactoring
- Example 15.10. Compiling regular expressions
- Example 15.11. Compiled regular expressions in roman81.py
- Example 15.12. Output of romantest81.py against roman81.py
- Example 15.13. roman82.py
- Example 15.14. Output of romantest82.py against roman82.py
- Example 15.15. roman83.py
- Example 15.16. Output of romantest83.py against roman83.py
- 15.4. Postscript
Chapter 16. Functional Programming
- 16.1. Diving in
- 16.2. Finding the path
- 16.3. Filtering lists revisited
- 16.4. Mapping lists revisited
- 16.6. Dynamically importing modules
- 16.7. Putting it all together
- Example 16.16. The regressionTest function
- Example 16.17. Step 1: Get all the files
- Example 16.18. Step 2: Filter to find the files you care about
- Example 16.19. Step 3: Map filenames to module names
- Example 16.20. Step 4: Mapping module names to modules
- Example 16.21. Step 5: Loading the modules into a test suite
- Example 16.22. Step 6: Telling unittest to use your test suite
- 17.2. plural.py, stage 1
- 17.3. plural.py, stage 2
- 17.4. plural.py, stage 3
- 17.5. plural.py, stage 4
- 17.6. plural.py, stage 5
- 17.7. plural.py, stage 6
<< Tips and tricks |
| | |
Revision history >> |