Differences between revisions 1 and 2
Revision 1 as of 2004-08-19 21:52:55
Size: 7611
Editor: Zoom.Quiet
Comment:
Revision 2 as of 2004-08-19 21:53:25
Size: 1022
Editor: Zoom.Quiet
Comment:
Deletions are marked like this. Additions are marked like this.
Line 17: Line 17:
Permission is granted to copy, distribute, and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in Appendix G, GNU Free Documentation License.

The example programs in this book are free software; you can redistribute and/or modify them under the terms of the Python license as published by the Python Software Foundation. A copy of the license is included in Appendix H, Python license.

== 章节索引 ==

1. Installing Python
1.1. Which Python is right for you?
1.2. Python on Windows
1.3. Python on Mac OS X
1.4. Python on Mac OS 9
1.5. Python on RedHat Linux
1.6. Python on Debian GNU/Linux
1.7. Python Installation from Source
1.8. The Interactive Shell
1.9. Summary
2. Your First Python Program
2.1. Diving in
2.2. Declaring Functions
2.2.1. How Python's Datatypes Compare to Other Programming Languages
2.3. Documenting Functions
2.4. Everything Is an Object
2.4.1. The Import Search Path
2.4.2. What's an Object?
2.5. Indenting Code
2.6. Testing Modules
3. Native Datatypes
3.1. Introducing Dictionaries
3.1.1. Defining Dictionaries
3.1.2. Modifying Dictionaries
3.1.3. Deleting Items From Dictionaries
3.2. Introducing Lists
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
3.7.1. Historical Note on String Methods
3.8. Summary
4. The Power Of Introspection
4.1. Diving In
4.2. Using Optional and Named Arguments
4.3. Using type, str, dir, and Other Built-In Functions
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
4.9. Summary
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.3.2. Knowing When to Use self and __init__
5.4. Instantiating Classes
5.4.1. Garbage Collection
5.5. Exploring UserDict: A Wrapper Class
5.6. Special Class Methods
5.6.1. Getting and Setting Items
5.7. Advanced Special Class Methods
5.8. Introducing Class Attributes
5.9. Private Functions
5.10. Summary
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
6.7. Summary
7. Regular Expressions
7.1. Diving In
7.2. Case Study: Street Addresses
7.3. Case Study: Roman Numerals
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
7.7. Summary
8. HTML Processing
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
8.10. Summary
9. XML Processing
9.1. Diving in
9.2. Packages
9.3. Parsing XML
9.4. Unicode
9.5. Searching for elements
9.6. Accessing element attributes
9.7. Segue
10. Scripts and Streams
10.1. Abstracting input sources
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
10.7. Putting it all together
10.8. Summary
11. HTTP Web Services
11.1. Diving in
11.2. How not to fetch data over HTTP
11.3. Features of HTTP
11.3.1. User-Agent
11.3.2. Redirects
11.3.3. Last-Modified/If-Modified-Since
11.3.4. ETag/If-None-Match
11.3.5. Compression
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
11.10. Summary
12. SOAP Web Services
12.1. Diving In
12.2. Installing the SOAP Libraries
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.5. Introducing WSDL
12.6. Introspecting SOAP Web Services with WSDL
12.7. Searching Google
12.8. Troubleshooting SOAP Web Services
12.9. Summary
13. Unit Testing
13.1. Introduction to Roman numerals
13.2. Diving in
13.3. Introducing romantest.py
13.4. Testing for success
13.5. Testing for failure
13.6. Testing for sanity
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. Refactoring
15.1. Handling bugs
15.2. Handling changing requirements
15.3. Refactoring
15.4. Postscript
15.5. Summary
16. Functional Programming
16.1. Diving in
16.2. Finding the path
16.3. Filtering lists revisited
16.4. Mapping lists revisited
16.5. Data-centric programming
16.6. Dynamically importing modules
16.7. Putting it all together
16.8. Summary
17. Dynamic functions
17.1. Diving in
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
17.8. Summary
18. Performance Tuning
18.1. Diving in
18.2. Using the timeit Module
18.3. Optimizing Regular Expressions
18.4. Optimizing Dictionary Lookups
18.5. Optimizing List Operations
18.6. Optimizing String Manipulation
18.7. Summary
A. Further reading
B. A 5-minute review
C. Tips and tricks
D. List of examples
E. Revision history
F. About the book
G. GNU Free Documentation License
G.0. Preamble
G.1. Applicability and definitions
G.2. Verbatim copying
G.3. Copying in quantity
G.4. Modifications
G.5. Combining documents
G.6. Collections of documents
G.7. Aggregation with independent works
G.8. Translation
G.9. Termination
G.10. Future revisions of this license
G.11. How to use this License for your documents
H. Python license
H.A. History of the software
H.B. Terms and conditions for accessing or otherwise using Python
H.B.1. PSF license agreement
H.B.2. BeOpen Python open source license agreement version 1
H.B.3. CNRI open source GPL-compatible license agreement
H.B.4. CWI permissions statement and disclaimer
Permission is granted to copy, distribute, and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the POST http://wiki.woodpecker.org.cn/moin.cgi/zhDiveIntoPython HTTP/1.0
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*
Referer: http://wiki.woodpecker.org.cn/moin.cgi/zhDiveIntoPython?action=edit
Accept-Language: zh-cn
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/4.0 (compatible

深入Python 5.4 版本,中文翻译!

-- Zoom.Quiet [DateTime(2004-08-19T21:52:55Z)] TableOfContents

Dive Into Python

20 May 2004

Copyright © 2000, 2001, 2002, 2003, 2004 Mark Pilgrim

This book lives at http://diveintopython.org/. If you're reading it somewhere else, you may not have the latest version.

Permission is granted to copy, distribute, and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the POST http://wiki.woodpecker.org.cn/moin.cgi/zhDiveIntoPython HTTP/1.0 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */* Referer: http://wiki.woodpecker.org.cn/moin.cgi/zhDiveIntoPython?action=edit Accept-Language: zh-cn Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/4.0 (compatible

zhDiveIntoPython (last edited 2009-12-25 07:18:54 by localhost)