Python Standard Library
/06/07 20:10:08 Compile 0.1. About this book 0.2. Code contract 0.3. About the example 0.4. How to contact our core Module 1.1. Introduction to 1.2. _ _builtin_ _ Module 1.3. Exceptions module 1.4. OS module 1.5. Os.path module 1.6. Stat Module 1.7. String Module 1.8. Re module 1.9. Math Module 1.10. Cmath module 1.11. Operator module 1.12. Copy module 1.13. SYS module 1.14. Atexit module 1.15. Time module 1.16. Types Module 1.17. GC module more standard module 2.1. Overview 2.2. Fileinput Module 2.3. Shutil Module 2.4. Tempfile module 2.5. Stringio Module 2.6. Cstringio Module 2.7. MMAP module 2.8. UserDict Module 2.9. UserList Module 2.10. UserString Module 2.11. Traceback Module 2.12. errno module 2.13. Getopt Module 2.14. Getpass module 2.15. Glob module 2.16. Fnmatch module 2.17. Random module 2.18. Whrandom module 2.19. MD5 module 2.20. SHA Module 2.21. Crypt Module 2.22. Rotor module 2.23. Zlib module 2.24. code module thread and process 3.1. Overview 3.2. Threading Module 3.3. Queue Module 3.4. Thread Module 3.5. Commands Module 3.6. Pipes module 3.7. Popen2 Module 3.8. Signal module data represents 4.1. Overview 4.2. Array module 4.3. struct Module 4.4. Xdrlib module 4.5. Marshal Module 4.6. Pickle Module 4.7. Cpickle Module 4.8. Copy_reg module 4.9. Pprint Module 4.10. REPR module 4.11. Base64 Module 4.12. BinHex Module 4.13. QUOPRI Module 4.14. UU Module 4.15. BINASCII module file Format 5.1. Overview 5.2. Xmllib Module 5.3. Xml.parsers.expat Module 5.4. Sgmllib module 5.5. Htmllib module 5.6. Htmlentitydefs module 5.7. Formatter module 5.8. Configparser module 5.9. NETRC module 5.10. Shlex module 5.11. ZipFile module 5.12. Gzip Module mail and news message processing 6.1. Overview 6.2. RFC822 module 6.3. Mimetools module 6.4. Mimewriter module 6.5. Mailbox Module 6.6. Mailcap Module 6.7. Mimetypes Module 6.8. Packmail Module 6.9. Mimify Module 6.10. Multifile Module Network Protocol 7.1. Overview 7.2. Socket Module 7.3. Select Module 7.4. Asyncore Module 7.5. Asynchat module 7.6. Urllib Module 7.7. Urlparse module 7.8. Cookie module 7.9. Robotparser module 7.10. Ftplib module 7.11. Gopherlib module 7.12. Httplib Module 7.13. Poplib module 7.14. Imaplib Module 7.15. Smtplib module 7.16. Telnetlib module 7.17. Nntplib module 7.18. Socketserver module 7.19. Basehttpserver module 7.20. Simplehttpserver module 7.21. Cgihttpserver module 7.22. CGI module 7.23. WebBrowser Module Internationalization 8.1. Locale Module 8.2. Unicodedata Module 8.3. Ucnhash Module Multimedia related Module 9.1. Overview 9.2. IMGHDR Module 9.3. SNDHDR module 9.4. Whatsound Module 9.5. AIFC Module 9.6. Sunau module 9.7. Sunaudio module 9.8. Wave module 9.9. AudiOdev module 9.10. WinSound Module Data storage 10.1. Overview 10.2. ANYDBM Module 10.3. WHICHDB Module 10.4. Shelve module 10.5. Dbhash module 10.6. DBM Module 10.7. DUMBDBM module 10.8. GDBM module tools and Utilities 11.1. Dis module 11.2. PDB module 11.3. BDB module 11.4. Profile Module 11.5. Pstats module 11.6. Tabnanny modules other modules 12.1. Overview 12.2. Fcntl Module 12.3. PWD Module 12.4. GRP Module 12.5. NIS module 12.6. Curses module 12.7. Termios module 12.8. TTY module 12.9. Resource Module 12.10. Syslog module 12.11. MSVCRT module 12.12. NT Module 12.13. _winreg module 12.14. The POSIX module executes support module 13.1. Dospath Module 13.2. Macpath Module 13.3. Ntpath module 13.4. Posixpath module 13.5. Strop module 13.6. IMP module 13.7. New module 13.8. Pre Module 13.9. SRE module 13.10. Py_compile module 13.11. Compileall module 13.12. Ihooks module 13.13. Linecache module 13.14. Macurl2path module 13.15. Nturl2path module 13.16. Tokenize module 13.17. Keyword Module 13.18. Parser module 13.19. Symbol Module 13.20. Token modules other modules 14.1. Overview 14.2. PYCLBR Module 14.3. FILECMP Module 14.4. CMD module 14.5. Rexec module 14.6. Bastion module 14.7. ReadLine module 14.8. Rlcompleter module 14.9. STATVFS module 14.10. Calendar Module 14.11. Sched Module 14.12. Statcache module 14.13. grep module 14.14. Dircache module 14.15. DIRCMP module 14.16. CMP module 14.17. Cmpcache module 14.18. Util module 14.19. Soundex module 14.20. Timing Module 14.21. Posixfile module 14.22. Bisect module 14.23. Knee Module 14.24. Tzparse module 14.25. Regex module 14.26. Regsub module 14.27. Reconvert module 14.28. Regex_syntax module 14.29. Find Module Py 2.0 after the new module PostScript "We" like to pretend that ' Fredrik ' was a role, but even hundreds of volunteers couldn ' t possibly Keep up. No, ' Fredrik ' is the "result of" crossing a HTTP server with a spam filter with a Emacs whatsit and some other stuff Es. "-gordon McMillan, June 1998
The Python 2.0 release comes with an extensible standard library that contains more than 200 modules. This book briefly introduces each module and provides at least one example to illustrate how to use it. This book contains 360 examples altogether. 0.1. About the book "Those people who have nothing better to do than post on the Internet all day long are rarely the ones Who have the most insights. "-Jakob Nielsen, December 1998
I ran into Python five years ago and started my Python trip, and I spent a lot of time answering questions in the Comp.lang.python newsgroup. Maybe someone found out that a module was exactly what he wanted, but he didn't know how to use it. Maybe some of the unsuitable modules that were chosen for his task. Maybe someone is tired of inventing new wheels. Most of the time, a short example is more helpful than a manual document.
This book is the essence of more than 3,000 newsgroup discussions, and of course there are a lot of new scripts to cover every corner of the standard library.
I try to make every script easy to understand and easy to reuse code. I intentionally shorten the length of the annotation, and if you want to get a deeper understanding of the background, you can refer to the reference manual in each Python release. The important thing about this book is the example code.
We welcome any comments, suggestions, and bug reports, please send them to fredrik@pythonware.com. I will read as much as I can to read all the emails, but perhaps the reply is not so timely.
For additional information about this book, please visit http://www.pythonware.com/people/fredrik/librarybook.htm
Why is there no tkinter?
This book covers the entire standard library, in addition to the (optional) Tkinter UI (user-interface: User interface) library. There are many reasons, more because of the time, the space of the book, and I am writing another book about Tkinter.
For information about these books, please visit http://www.pythonware.com/people/fredrik/tkinterbook.htm. (Don't look, 1404)
Product Details
This book is written using DocBook SGML, and I use a series of tools including Secret Labs ' Pythonworks, Excosoft documentor, James Clark ' Jade Dsssl, processor Walsh ' s DocBook stylesheets, and of course, there are some Python scripts.
Thanks to the people who helped proofread: Tim Peters, Guido van Rossum, David Ascher, Mark Lutz, and Rael Dornfest, and Pythonware members: Matthew Ellis, Håkan Karlsson, and Rune Uhlin.
Thanks to Lenny Muellner, he helped me transform the SGML file into the book you see now, as well as Christien Shangraw, who assembled the code files to make a CD with the book (available in http:// Examples.oreilly.com/pythonsl found, unexpectedly not 404, miracle). 0.2. Code Contracts
This book uses the following idioms:
Italic is used for file names and commands. Also used to define terms.
Equal-width font e.g. Python is used for the names of code and methods, modules, operators, functions, statements, attributes, and so on.
The equal-width bold is used for code execution results. 0.3. With regard to examples
Unless mentioned, all examples can be run under Python 1.5.2 and Python 2.0. Can you execute in Python 2.4/2.5 ... Look at all of you who are involved in translating.
In addition to some platform-related module scripts, all examples can be performed under Windows, Solaris, and Linux.
All the code is copyrighted. Of course, you are free to use these modules, and don't forget where you got these.
Most examples of file names contain the name of the module that it uses, with the "-example-" and a unique "serial number" behind it. Note that some examples do not appear sequentially, in order to match an earlier version of the book-(The Eff-bot Guide to) the Standard Python Library.
You can find the contents of this book with CDs on the Internet (see HTTP://EXAMPLES.OREILLY.COM/PYTHONSL). See http://www.pythonware.com/people/fredrik/librarybook.htm for more information and updates. (FT, 1404. We must not look ~) 0.4. How to contact Us
Python Lake QQ Group: 43680167<