Introduction
1. Installing Python
Which Python is right for you?
Python on Windows
Python on Mac OS X
Python on Mac OS 9
Python on RedHat Linux
Python on Debian GNU/Linux
Python Installation from Source
The Interactive Shell
Summary
2. Your First Python Program
Diving in
Declaring Functions
Everything Is an Object
Indenting Code
Testing Modules: The if name Trick
3. Native Datatypes
Introducing Dictionaries
Introducing Lists
Introducing Tuples
Declaring variables
Formatting Strings
Mapping Lists
Joining Lists and Splitting Strings
Summary
4. The Power Of Introspection
Diving In
Using Optional and Named Arguments
Using type, str, dir, and Other Built-In Functions
Getting Object References With getattr
Filtering Lists
Understanding the Peculiar Nature of and and or
Using lambda Functions
Putting It All Together
Summary
5. Objects and Object-Orientation
Diving In
Importing Modules Using from module import
Defining Classes
Instantiating Classes
Exploring UserDict: A Wrapper Class
Using Special Class Methods
Introducing Class Attributes
Using Private Functions
Summary
6. Exceptions and File Handling
Handling Exceptions
Working with File Objects
Iterating with for Loops
Using sys.modules
Putting It All Together
Summary
7. Regular Expressions
Diving In
Case Study: Street Addresses
Case Study: Roman Numerals
Verbose Regular Expressions
Case study: Parsing Phone Numbers
Summary
8. HTML Processing
Diving in
Introducing Python's sgmllib.py
Extracting data from HTML documents
Understanding locals and globals
Using Dictionary-based string formatting
Quoting attribute values
Parsing HTML One Tag at a Time
Putting it all together
Summary
9. XML Processing
Diving in
Importing Python Packages
Parsing XML
Dealing with Unicode
Searching for XML elements
Accessing XML element attributes
Summary
10. Scripts and Streams
Abstracting input sources
Standard input, output, and error
Introducing some XML processing techniques
Handling command-line arguments
Putting it all together
Summary
11. HTTP Web Services
Diving in
How not to fetch data over HTTP
Supporting HTTP features
Debugging HTTP Web Services
Setting the User-Agent
Handling Last-Modified and Etag
Handling redirects
Handling compressed data
Putting it all together
Summary
12. SOAP Web Services
Diving In
Installing the SOAP Libraries
Taking Your First Steps with SOAP
Introducing WSDL
Searching Google
Troubleshooting SOAP Web Services
Summary
13. Unit Testing
Diving in
Introducing the test suit
Constructing testing cases
Summary
14. Test-First Programming
Diving in (Stage 1)
Converting Roman Numerals, stage 2
Converting Roman Numerals, stage 3
Converting Roman Numerals, stage 4
Converting Roman Numerals, stage 5
Summary
15. Refactoring
Diving In
Handling changing requirements
Refactoring for performance
Postscript
Summary
16. Functional Programming
Diving in
Finding the path
Filtering lists revisited
Mapping lists revisited
Data-centric programming
Dynamically importing modules
Putting it all together
Summary
17. Dynamic functions
Diving in
Pluralizing Nouns, stage 1
Pluralizing Nouns, stage 2
Pluralizing Nouns, stage 3
Pluralizing Nouns, stage 4
Pluralizing Nouns, stage 5
Pluralizing Nouns, stage 6
Summary
18. Performance Tuning
Diving in
Using the timeit Module
Optimizing Regular Expressions
Optimizing Dictionary Lookups
Optimizing List Operations
Optimizing String Manipulation
Summary
Appendix A. Python License
Appendiz B. GNU Free Documentation License
Summary