logo资料库

Python Module of the Week 无水印pdf.pdf

第1页 / 共953页
第2页 / 共953页
第3页 / 共953页
第4页 / 共953页
第5页 / 共953页
第6页 / 共953页
第7页 / 共953页
第8页 / 共953页
资料共953页,剩余部分请下载后查看
Cover
Data Persistence and Exchange
Serializing Objects
Storing Serialized Objects
Relational Databases
Data Exchange Through Standard Formats
In-Memory Data Structures
array
Sorting
Queue
collections
Decoding Data
Custom Variations
File Access
Filenames
Meta-data
Reading Files
Temporary Files
Files and Directories
Text Processing Tools
string module
Text Input
Text Output
Comparing Values
Built-in Objects
exceptions – Built-in error classes
String Services
codecs – String encoding and decoding
difflib – Compare sequences
string – Working with text
StringIO and cStringIO – Work with text buffers using file-like API
re – Regular Expressions
struct – Working with Binary Data
textwrap – Formatting text paragraphs
Data Types
array – Sequence of fixed-type data
datetime – Date/time value manipulation
calendar – Work with dates
collections – Container data types
heapq – In-place heap sort algorithm
bisect – Maintain lists in sorted order
sched – Generic event scheduler.
Queue – A thread-safe FIFO implementation
weakref – Garbage-collectable references to objects
copy – Duplicate objects
pprint – Pretty-print data structures
Numeric and Mathematical Modules
decimal – Fixed and floating point math
fractions – Rational Numbers
functools – Tools for Manipulating Functions
itertools – Iterator functions for efficient looping
math – Mathematical functions
operator – Functional interface to built-in operators
random – Pseudorandom number generators
Internet Data Handling
base64 – Encode binary data into ASCII characters
json – JavaScript Object Notation Serializer
mailbox – Access and manipulate email archives
mhlib – Work with MH mailboxes
File Formats
csv – Comma-separated value files
ConfigParser – Work with configuration files
robotparser – Internet spider access control
Cryptographic Services
hashlib – Cryptographic hashes and message digests
hmac – Cryptographic signature and verification of messages.
File and Directory Access
os.path – Platform-independent manipulation of file names.
fileinput – Process lines from input streams
filecmp – Compare files
tempfile – Create temporary filesystem resources.
glob – Filename pattern matching
fnmatch – Compare filenames against Unix-style glob patterns.
linecache – Read text files efficiently
shutil – High-level file operations.
dircache – Cache directory listings
Data Compression and Archiving
bz2 – bzip2 compression
gzip – Read and write GNU zip files
tarfile – Tar archive access
zipfile – Read and write ZIP archive files
zlib – Low-level access to GNU zlib compression library
Data Persistence
anydbm – Access to DBM-style databases
dbhash – DBM-style API for the BSD database library
dbm – Simple database interface
dumbdbm – Portable DBM Implementation
gdbm – GNU's version of the dbm library
pickle and cPickle – Python object serialization
shelve – Persistent storage of arbitrary Python objects
whichdb – Identify DBM-style database formats
sqlite3 – Embedded Relational Database
Generic Operating System Services
os – Portable access to operating system specific features.
time – Functions for manipulating clock time
getopt – Command line option parsing
optparse – Command line option parser to replace getopt.
argparse – Command line option and argument parsing.
logging – Report status, error, and informational messages.
getpass – Prompt the user for a password without echoing.
platform – Access system version information
Optional Operating System Services
threading – Manage concurrent threads
mmap – Memory-map files
multiprocessing – Manage processes like threads
readline – Interface to the GNU readline library
rlcompleter – Adds tab-completion to the interactive interpreter
Unix-specific Services
commands – Run external shell commands
grp – Unix Group Database
pipes – Unix shell command pipeline templates
pwd – Unix Password Database
resource – System resource management
Interprocess Communication and Networking
asynchat – Asynchronous protocol handler
asyncore – Asynchronous I/O handler
signal – Receive notification of asynchronous system events
subprocess – Work with additional processes
Internet Protocols and Support
BaseHTTPServer – base classes for implementing web servers
cgitb – Detailed traceback reports
Cookie – HTTP Cookies
imaplib - IMAP4 client library
SimpleXMLRPCServer – Implements an XML-RPC server.
smtpd – Sample SMTP Servers
smtplib – Simple Mail Transfer Protocol client
socket – Network Communication
select – Wait for I/O Efficiently
SocketServer – Creating network servers.
urllib – simple interface for network resource access
urllib2 – Library for opening URLs.
urlparse – Split URL into component pieces.
uuid – Universally unique identifiers
webbrowser – Displays web pages
xmlrpclib – Client-side library for XML-RPC communication
Structured Markup Processing Tools
xml.etree.ElementTree – XML Manipulation API
Internationalization
gettext – Message Catalogs
locale – POSIX cultural localization API
Program Frameworks
cmd – Create line-oriented command processors
shlex – Lexical analysis of shell-style syntaxes.
Development Tools
doctest – Testing through documentation
pydoc – Online help for Python modules
unittest – Automated testing framework
pdb – Interactive Debugger
Debugging and Profiling
profile, cProfile, and pstats – Performance analysis of Python programs.
timeit – Time the execution of small bits of Python code.
trace – Follow Python statements as they are executed
Python Runtime Services
abc – Abstract Base Classes
atexit – Call functions when a program is closing down
contextlib – Context manager utilities
gc – Garbage Collector
inspect – Inspect live objects
site – Site-wide configuration
sys – System-specific Configuration
sysconfig – Interpreter Compile-time Configuration
traceback – Extract, format, and print exceptions and stack traces.
warnings – Non-fatal alerts
Importing Modules
imp – Interface to module import mechanism.
pkgutil – Package Utilities
zipimport – Load Python code from inside ZIP archives
Miscelaneous
EasyDialogs – Carbon dialogs for Mac OS X
plistlib – Manipulate OS X property list files
History
Python Module Index
Index
Python Module of the Week Release 1.132 Doug Hellmann July 08, 2011
CONTENTS 1 Data Persistence and Exchange . . Serializing Objects . . Storing Serialized Objects . . Relational Databases . 1.1 1.2 1.3 1.4 Data Exchange Through Standard Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 In-Memory Data Structures . . . . . . . 2.1 . 2.2 . 2.3 Queue . . 2.4 2.5 Decoding Data . 2.6 . . . . . Custom Variations . array . . Sorting . . collections . . . . . . . . . . . . . . . . 3 File Access . . 3.1 Filenames . 3.2 Meta-data . 3.3 3.4 3.5 . . . . . Reading Files . Temporary Files . Files and Directories . . . . . . . . . . . . 4 Text Processing Tools . string module . . . Text Input . . Text Output . . . Comparing Values . 4.1 4.2 4.3 4.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Built-in Objects 5.1 exceptions – Built-in error classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 String Services 6.1 6.2 6.3 6.4 6.5 6.6 6.7 codecs – String encoding and decoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . difflib – Compare sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . string – Working with text . StringIO and cStringIO – Work with text buffers using file-like API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . re – Regular Expressions . struct – Working with Binary Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . textwrap – Formatting text paragraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Data Types 3 3 3 3 4 5 5 5 5 5 6 6 7 7 7 7 7 8 9 9 9 9 9 11 11 23 23 43 49 54 55 90 93 97 i
. . 97 array – Sequence of fixed-type data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1 datetime – Date/time value manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 7.2 calendar – Work with dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 7.3 collections – Container data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 7.4 heapq – In-place heap sort algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 7.5 bisect – Maintain lists in sorted order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 7.6 7.7 sched – Generic event scheduler. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 7.8 Queue – A thread-safe FIFO implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 7.9 weakref – Garbage-collectable references to objects . . . . . . . . . . . . . . . . . . . . . . . . . . 135 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 7.10 copy – Duplicate objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 7.11 pprint – Pretty-print data structures . . . 8 Numeric and Mathematical Modules 153 decimal – Fixed and floating point math . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 fractions – Rational Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 functools – Tools for Manipulating Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 itertools – Iterator functions for efficient looping . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 operator – Functional interface to built-in operators . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 random – Pseudorandom number generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 8.1 8.2 8.3 8.4 8.5 math – Mathematical functions 8.6 8.7 . 9 Internet Data Handling 213 base64 – Encode binary data into ASCII characters . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 9.1 . 215 9.2 json – JavaScript Object Notation Serializer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3 mailbox – Access and manipulate email archives . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 9.4 mhlib – Work with MH mailboxes . 10 File Formats 233 10.1 csv – Comma-separated value files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 10.2 ConfigParser – Work with configuration files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 10.3 robotparser – Internet spider access control . 252 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Cryptographic Services 255 11.1 hashlib – Cryptographic hashes and message digests . . . . . . . . . . . . . . . . . . . . . . . . . . 255 11.2 hmac – Cryptographic signature and verification of messages. . . . . . . . . . . . . . . . . . . . . . 258 12 File and Directory Access 263 . . . . . . . . . . . . . . . . . . . . . . 263 12.1 os.path – Platform-independent manipulation of file names. . 268 12.2 fileinput – Process lines from input streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 12.3 filecmp – Compare files 12.4 tempfile – Create temporary filesystem resources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 12.5 glob – Filename pattern matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 12.6 fnmatch – Compare filenames against Unix-style glob patterns. . . . . . . . . . . . . . . . . . . . . 285 12.7 linecache – Read text files efficiently . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 12.8 shutil – High-level file operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 12.9 dircache – Cache directory listings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 . . . . 13 Data Compression and Archiving . 299 13.1 bz2 – bzip2 compression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 13.2 gzip – Read and write GNU zip files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 13.3 tarfile – Tar archive access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 13.4 zipfile – Read and write ZIP archive files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318 13.5 zlib – Low-level access to GNU zlib compression library . . . . . . . . . . . . . . . . . . . . . . . . 326 . . . . . . 14 Data Persistence ii 333
14.1 anydbm – Access to DBM-style databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 14.2 dbhash – DBM-style API for the BSD database library . . . . . . . . . . . . . . . . . . . . . . . . . 335 14.3 dbm – Simple database interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 14.4 dumbdbm – Portable DBM Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 14.5 gdbm – GNU’s version of the dbm library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 14.6 pickle and cPickle – Python object serialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 . . . . . . . . . . . . . . . . . . . . . . . . . 344 14.7 shelve – Persistent storage of arbitrary Python objects 14.8 whichdb – Identify DBM-style database formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 14.9 sqlite3 – Embedded Relational Database 15 Generic Operating System Services 377 15.1 os – Portable access to operating system specific features. . . . . . . . . . . . . . . . . . . . . . . . 377 15.2 time – Functions for manipulating clock time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 15.3 getopt – Command line option parsing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 15.4 optparse – Command line option parser to replace getopt. . . . . . . . . . . . . . . . . . . . . . . . 402 15.5 argparse – Command line option and argument parsing. . . . . . . . . . . . . . . . . . . . . . . . . 414 15.6 logging – Report status, error, and informational messages. . . . . . . . . . . . . . . . . . . . . . . . 433 15.7 getpass – Prompt the user for a password without echoing. . . . . . . . . . . . . . . . . . . . . . . . 437 15.8 platform – Access system version information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 16 Optional Operating System Services 443 16.1 threading – Manage concurrent threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443 16.2 mmap – Memory-map files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 16.3 multiprocessing – Manage processes like threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463 16.4 readline – Interface to the GNU readline library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 16.5 rlcompleter – Adds tab-completion to the interactive interpreter . . . . . . . . . . . . . . . . . . . . 493 . . 17 Unix-specific Services 495 17.1 commands – Run external shell commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 17.2 grp – Unix Group Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497 17.3 pipes – Unix shell command pipeline templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500 17.4 pwd – Unix Password Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506 17.5 resource – System resource management . 509 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513 18 Interprocess Communication and Networking 18.1 asynchat – Asynchronous protocol handler . 513 18.2 asyncore – Asynchronous I/O handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518 18.3 signal – Receive notification of asynchronous system events . . . . . . . . . . . . . . . . . . . . . . 530 18.4 subprocess – Work with additional processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Internet Protocols and Support . . 547 19.1 BaseHTTPServer – base classes for implementing web servers . . . . . . . . . . . . . . . . . . . . . 547 19.2 cgitb – Detailed traceback reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552 . 19.3 Cookie – HTTP Cookies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569 19.4 imaplib - IMAP4 client library . 19.5 SimpleXMLRPCServer – Implements an XML-RPC server. . . . . . . . . . . . . . . . . . . . . . . 584 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592 19.6 smtpd – Sample SMTP Servers 19.7 smtplib – Simple Mail Transfer Protocol client . 595 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599 19.8 socket – Network Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622 19.9 select – Wait for I/O Efficiently . . 19.10 SocketServer – Creating network servers. . 632 19.11 urllib – simple interface for network resource access . . . . . . . . . . . . . . . . . . . . . . . . . . 639 19.12 urllib2 – Library for opening URLs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645 19.13 urlparse – Split URL into component pieces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654 19.14 uuid – Universally unique identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
19.15 webbrowser – Displays web pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661 19.16 xmlrpclib – Client-side library for XML-RPC communication . . . . . . . . . . . . . . . . . . . . . 663 20 Structured Markup Processing Tools 671 20.1 xml.etree.ElementTree – XML Manipulation API . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671 21 Internationalization 21.1 gettext – Message Catalogs 21.2 locale – POSIX cultural localization API . . . . 691 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697 22 Program Frameworks 22.1 cmd – Create line-oriented command processors 22.2 shlex – Lexical analysis of shell-style syntaxes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705 . 714 23 Development Tools 723 . 723 23.1 doctest – Testing through documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.2 pydoc – Online help for Python modules . 742 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.3 unittest – Automated testing framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743 23.4 pdb – Interactive Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749 . . 24 Debugging and Profiling 777 24.1 profile, cProfile, and pstats – Performance analysis of Python programs. . . . . . . . . . . . . . . . . 777 24.2 timeit – Time the execution of small bits of Python code. . . . . . . . . . . . . . . . . . . . . . . . . 782 24.3 trace – Follow Python statements as they are executed . . . . . . . . . . . . . . . . . . . . . . . . . 787 25 Python Runtime Services . 795 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795 25.1 abc – Abstract Base Classes . 25.2 atexit – Call functions when a program is closing down . . . . . . . . . . . . . . . . . . . . . . . . . 802 25.3 contextlib – Context manager utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 805 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810 . 25.4 gc – Garbage Collector . . . 25.5 inspect – Inspect live objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 826 25.6 site – Site-wide configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 836 . 25.7 sys – System-specific Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 842 25.8 sysconfig – Interpreter Compile-time Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 881 25.9 traceback – Extract, format, and print exceptions and stack traces. . . . . . . . . . . . . . . . . . . . 885 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 890 25.10 warnings – Non-fatal alerts . . . . . . 26 Importing Modules 26.1 imp – Interface to module import mechanism. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26.2 pkgutil – Package Utilities . 26.3 zipimport – Load Python code from inside ZIP archives 897 . 897 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 900 . . . . . . . . . . . . . . . . . . . . . . . . 907 . . 27 Miscelaneous 27.1 EasyDialogs – Carbon dialogs for Mac OS X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.2 plistlib – Manipulate OS X property list files 913 . 913 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 926 28 History Python Module Index Index iv 931 943 945
About Python Module of the Week Python Module of the Week, Release 1.132 PyMOTW is a series of blog posts written by Doug Hellmann (http://www.doughellmann.com/). It was started as a way to build the habit of writing something on a regular basis. The focus of the series is building a set of example code for the modules in the Python (http://www.python.org/) standard library. Complete http://docs.python.org/library/contents.html. the Python web documentation standard library found site can the for on be at Tools The source text for PyMOTW is reStructuredText (http://docutils.sourceforge.net/) and the HTML and PDF output are created using Sphinx (http://sphinx.pocoo.org/). Subscribe new articles As Updates (http://www.feedburner.com/fb/a/emailverifySubmit?feedId=806224&loc=en_US). See page for details (http://www.doughellmann.com/PyMOTW/). posted (http://feeds.feedburner.com/PyMOTW) are written, available (http://blog.doughellmann.com/). email the project home to my RSS blog they and are are by Translations and Other Versions a Cai and Yan have code called Sheng started google project PyMOTWCN Junjie (http://code.google.com/p/pymotwcn/) and posted the completed translations at http://www.vbarter.cn/pymotw/. Ralf Schönian is translating PyMOTW into German, following an alphabetical order. The results are avail- able on his web site, http://schoenian-online.de/pymotw.html. Ralf is an active member of the pyCologne (http://wiki.python.de/User_Group_K%C3%B6ln?action=show&redirect=pyCologne) user group in Germany and au- thor of pyVoc, the open source English/German vocabulary trainer (http://code.google.com/p/pyvoc/). Roberto Pauletto is working on an Italian translation at http://robyp.x10hosting.com/. Roberto creates Windows ap- plications with C# by day, and tinkers with Linux and Python at home. He has recently moved to Python from Perl for all of his system-administration scripting. Ernesto Rico Schmidt (http://denklab.org/) provides a Spanish translation that follows the English version posts. Ernesto is in Bolivia, and is translating these examples as a way to contribute to the members of the Bo- livian Free Software (http://www.softwarelibre.org.bo/) community who use Python. The full list of articles available in Spanish can be found at http://denklab.org/articles/category/pymotw/, and there is an RSS feed (http://denklab.org/feeds/articles/category/pymotw/). Tetsuya Morimoto (http://d.hatena.ne.jp/t2y-1979/) is creating a Japanese translation. Tetsuya has used Python for 1.5 years. He has as experience at a Linux Distributor using Python with yum, anaconda, and rpm-tools while building RPM packages. Now, he uses it to make useful tools for himself, and is interested in application frameworks such as Django, mercurial and wxPython. Tetsuya is a member of Python Japan User’s Group (http://www.python.jp/Zope/) and Python Code Reading (http://groups.google.co.jp/group/python-code-reading). The home page for his translation is http://d.hatena.ne.jp/t2y-1979/20090525/1243227350. Gerard Flanagan is working on a “Python compendium” called The Hazel Tree (http://www.thehazeltree.org/). He is converting a collection of old and new of Python-related reference material into reStructuredText and then building a single searchable repository from the results. I am very pleased to have PyMOTW included with works from authors like Mark Pilgrim, Fredrik Lundh, Andrew Kuchling, and a growing list of others. CONTENTS 1
Python Module of the Week, Release 1.132 Other Contributors Thank you to John Benediktsson for the original HTML-to-reST conversion. Copyright All of the prose from the Python Module of the Week is licensed under a Creative Commons Attribution, Non- commercial, Share-alike 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/us/) license. You are free to share and create derivative works from it. If you post the material online, you must give attribution and link to the PyMOTW home page (http://www.doughellmann.com/PyMOTW/). You may not use this work for commercial purposes. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. The source code included here is copyright Doug Hellmann and licensed under the BSD license. Copyright Doug Hellmann, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Doug Hellmann not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, IN- CLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. This section of the PyMOTW guide includes feature-based introductions to several modules in the standard library, organized by what your goal might be. Each article may include cross-references to several modules from different parts of the library, and show how they relate to one another. 2 CONTENTS
分享到:
收藏