## page was renamed from zhArticleTemplate ##language:zh #pragma section-numbers off 当前进度: 100 % 完成 ::-andelf [2008-01-11] 08.1.11 日更新 * 下载:[[http://openbookproject.googlecode.com/files/PythonStandardLib.zh_cn.t2t.src.zip|PythonStandardLib.zh_cn.t2t.src.zip]]^080101版本^ '''Python Standard Library''' ''翻译: Python 江湖群'' 2008-03-28 00:05:07 <> ---- "We'd like to pretend that 'Fredrik' is a role, but even hundreds of volunteers couldn't possibly keep up. No, 'Fredrik' is the result of crossing an http server with a spam filter with an emacs whatsit and some other stuff besides." -Gordon McMillan, June 1998 Python 2.0发布附带了一个包含200个以上模块的可扩展的标准库. 本书简要地介绍每个模块并提供至少一个例子来说明如何使用它. 本书一共包含360个例子. = 前言 = == 0.1. 关于本书 == "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 五年前我偶然遇到了 Python, 开始了我的 Python 之旅, 我花费了大量的时间 在 {{{comp.lang.python}}} 新闻组里回答问题. 也许某个人发现一个模块正是他想要的, 但是却不知道如何使用它. 也许某个人为他的任务挑选的不合适的模块. 也许某个人已经厌 倦了发明新轮子. 大多时候, 一个简短的例子要比一份手册文档更有帮助. 本书是超过3,000个新闻组讨论的精华部分, 当然也有很多的新脚本, 为了涵盖标准库的每个角落. 我尽力使得每个脚本都易于理解, 易于重用代码. 我有意缩短注释的长度, 如果你想更深入地 了解背景, 那么你可以参阅每个 Python 发布中的参考手册. 本书的重要之处在于范例代码. 我们欢迎任何评论, 建议, 以及 bug 报告, 请将它们发送到 [fredrik@pythonware.com]. 我将阅读尽我所能阅读所有的邮件, 但可能回复不是那么及时. 本书的相关更新内容以及其他信息请访问 [[http://www.pythonware.com/people/fredrik/librarybook.htm]] '''为什么没有Tkinter?''' 本书涵盖了整个标准库, 除了(可选的)Tkinter ui(user-interface : 用户界面) 库. 有很多原因, 更多是因为时间, 本书的空间, 以及我正在写另一本关于 Tkinter 的书. 关于这些书的信息, 请访问 [[http://www.pythonware.com/people/fredrik/tkinterbook.htm]]. (不用看了,又一404) '''产品细节''' 本书使用DocBook SGML编写, 我使用了一系列的工具, 包括Secret Labs' PythonWorks, Excosoft Documentor, James Clark's Jade DSSSL processor, Norm Walsh's DocBook stylesheets, 当然,还有一些 Python 脚本. 感谢帮忙校对的人们: Tim Peters, Guido van Rossum, David Ascher, Mark Lutz, 和 Rael Dornfest, 以及 PythonWare 成员: Matthew Ellis, Håkan Karlsson, 和 Rune Uhlin. 感谢 Lenny Muellner, 他帮助我把SGML文件转变为你们现在所看到的这本书, 以及Christien Shangraw, 他将那些代码文件集合起来做成了随书CD (可以在 [[http://examples.oreilly.com/pythonsl]] 找到, 竟然没有404, 奇迹). == 0.2. 代码约定 == 本书使用以下习惯用法: ''斜体'' 用于文件名和命令. 还用于定义术语. {{{等宽字体 e.g. Python}}} 用于代码以及方法,模块,操作符,函数,语句,属性等的名称. '''{{{等宽粗体}}}''' 用于代码执行结果. == 0.3. 关于例子 == 除非提到,所有例子都可以在 Python 1.5.2 和 Python 2.0 下运行. 能不能在 Python 2.4/2.5 下执行.....看参与翻译各位的了. 除了一些平台相关模块的脚本, 所有例子都可以在 Windows, Solaris, 以及 Linux 下正常执行. 所有代码都是有版权的. 当然,你可以自由地使用这些这些模块,别忘记你是从哪得到(?学会)这些的. 大多例子的文件名都包含它所使用的模块名称,后边是 "{{{-example-}}}" 以及一个唯一的"序号". 注意有些例子并不是按顺序出现的, 这是为了匹配本书的较早版本 - ''(the eff-bot guide to) The Standard Python Library''. 你可以在网上找到本书附带CD的内容 (参阅 [[http://examples.oreilly.com/pythonsl]]). 更多信息以及更新内容参阅 [[http://www.pythonware.com/people/fredrik/librarybook.htm]]. (ft, 又一404. 大家一定不要看~) == 0.4. 如何联系我们 == Python 江湖 QQ 群: 43680167 Feather (校对) QQ: 85660100 ---- = 1. 模块索引 = 1. [[/chpt1| 核心模块]] * _ _builtin_ _ 模块 * exceptions 模块 * os 模块 * os.path 模块 * stat 模块 * string 模块 * re 模块 * math 模块 * cmath 模块 * operator 模块 * copy 模块 * sys 模块 * atexit 模块 * time 模块 * types 模块 * gc 模块 2. [[/chpt2| 更多标准模块]] * fileinput 模块 * shutil 模块 * tempfile 模块 * StringIO 模块 * cStringIO 模块 * mmap 模块 * UserDict 模块 * UserList 模块 * UserString 模块 * traceback 模块 * errno 模块 * getopt 模块 * getpass 模块 * glob 模块 * fnmatch 模块 * random 模块 * whrandom 模 * md5 模块 * sha 模块 * crypt 模块 * rotor 模块 * zlib 模块 * code 模块 3. [[/chpt3| 线程和进程]] * threading 模块 * Queue 模块 * thread 模块 * commands 模块 * pipes 模块 * popen2 模块 * signal 模块 4. [[/chpt4| 数据表示]] * array 模块 * struct 模块 * xdrlib 模块 * marshal 模块 * pickle 模块 * cPickle 模块 * copy_reg 模块 * pprint 模块 * repr 模块 * base64 模块 * binhex 模块 * quopri 模块 * uu 模块 * binascii 模块 5. [[/chpt5| 文件格式]] * xmllib 模块 * xml.parsers.expat 模块 * sgmllib 模块 * htmllib 模块 * htmlentitydefs 模块 * formatter 模块 * ConfigParser 模块 * netrc 模块 * shlex 模块 * zipfile 模块 * gzip 模块 6. [[/chpt6| 邮件和新闻消息处理]] * rfc822 模块 * mimetools 模块 * MimeWriter 模块 * mailbox 模块 * mailcap 模块 * mimetypes 模块 * packmail 模块 * mimify 模块 * multifile 模块 7. [[/chpt7| 网络协议]] * socket 模块 * select 模块 * asyncore 模块 * asynchat 模块 * urllib 模块 * urlparse 模块 * cookie 模块 * robotparser 模块 * ftplib 模块 * gopherlib 模块 * httplib 模块 * poplib 模块 * imaplib 模块 * smtplib 模块 * telnetlib 模块 * nntplib 模块 * SocketServer 模块 * BaseHTTPServer 模块 * SimpleHTTPServer 模块 * CGIHTTPServer 模块 * cgi 模块webbrowser 模块 8. [[/chpt8| 国际化]] * locale 模块 * unicodedata 模块 * ucnhash 模块 9. [[/chpt9| 多媒体相关模块]] * imghdr 模块 * sndhdr 模块 * whatsound 模块 * aifc 模块 * sunau 模块 * sunaudio 模块 * wave 模块 * audiodev 模块 * winsound 模块 10. [[/chpt10| 数据储存]] * anydbm 模块 * whichdb 模块 * shelve 模块 * dbhash 模块 * dbm 模块 * dumbdbm 模块 * gdbm 模块 11. [[/chpt11| 工具和实用程序]] * dis 模块 * pdb 模块 * bdb 模块 * profile 模块 * pstats 模块 * tabnanny 模块 12. [[/chpt12| 其他模块]] * fcntl 模块 * pwd 模块 * grp 模块 * nis 模块 * curses 模块 * termios 模块 * tty 模块 * resource 模块 * syslog 模块 * msvcrt 模块 * nt 模块 * _winreg 模块 * posix 模块 13. [[/chpt13| 执行支持模块]] * dospath 模块 * macpath 模块 * ntpath 模块 * posixpath 模块 * strop 模块 * imp 模块 * new 模块 * pre 模块 * sre 模块 * py_compile 模块 * compileall 模块 * ihooks 模块 * linecache 模块 * macurl2path 模块 * nturl2path 模块 * tokenize 模块 * keyword 模块 * parser 模块 * symbol 模块 * token 模块 14. [[/chpt14| 其他模块]] * pyclbr 模块 * filecmp 模块 * cmd 模块 * rexec 模块 * Bastion 模块 * readline 模块 * rlcompleter 模块 * statvfs 模块 * calendar 模块 * sched 模块 * statcache 模块 * grep 模块 * dircache 模块 * dircmp 模块 * cmp 模块 * cmpcache 模块 * util 模块 * soundex 模块 * timing 模块 * posixfile 模块 * bisect 模块 * knee 模块 * tzparse 模块 * regex 模块 * regsub 模块 * reconvert 模块 * regex_syntax 模块 * find 模块 15. [[/chpt15| Py2.0后新增模块]] * 本章将在以后的时间里慢慢完成, 更新. ---- = 2. 后记 = ## moin code generated by txt2tags 2.4 (http://txt2tags.sf.net) ## cmdline: txt2tags -t moin -o moin/chapter0.moin chapter0.t2t 联系 [gt: andelf@gmail.com] = 交流 = <>