Python库参考手册(PythonLibrary
Reference)
Release2.3.3
GuidovanRossumFredL.Drake,Jr.,editor翻译团队:见文末名单
译文最后修改:2004年3月22日
PythonLabs
Email:
docs@python.org
Copyright??c2001,2002,2003PythonSoftwareFoundation.Allrightsreserved.Copyright??c2000BeOpen.com.Allrightsreserved.
Copyright??c1995-2000CorporationforNationalResearchInitiatives.Allrightsreserved.Copyright??c1991-1995StichtingMathematischCentrum.Allrightsreserved.Seetheendofthisdocumentforcompletelicenseandpermissionsinformation.详细版权及使用许可的资料见本文的最后部份.
Pythonisanextensible,interpreted,object-orientedprogramminglanguage.Itsupportsawiderangeofapplica-tions,fromsimpletextprocessingscriptstointeractiveWebbrowsers.
Python是一种可扩展的,即译式,面向对象规格的编程语言.它能应用在极广泛的地方,从简单的文字处理工作到交互式的网页浏览器.
WhilethePythonReferenceManualdescribestheexactsyntaxandsemanticsofthelanguage,itdoesnotdescribethestandardlibrarythatisdistributedwiththelanguage,andwhichgreatlyenhancesitsimmediateusability.Thislibrarycontainsbuilt-inmodules(writteninC)thatprovideaccesstosystemfunctionalitysuchas?leI/OthatwouldotherwisebeinaccessibletoPythonprogrammers,aswellasmoduleswritteninPythonthatprovidestandardizedsolutionsformanyproblemsthatoccurineverydayprogramming.SomeofthesemodulesareexplicitlydesignedtoencourageandenhancetheportabilityofPythonprograms.
Python语言参考手册中精确地描述了Python语言的句法及语义.然而语言参考手册中没有提到Python所附带功能强大的标准库.这个函式库大大地增强了Python的实用性.其中包括C写的内建模组,提供介面让程式进行操作系统层次的工作,例如档案的输出输入;同时也有以Python语言本身编写的模组,为实际编程时常遇的问题提供标准解决方案.这类模组有的经过特别设计以便Python程式在跨平台的情况下运行无误.
ThislibraryreferencemanualdocumentsPython’sstandardlibrary,aswellasmanyoptionallibrarymodules(whichmayormaynotbeavailable,dependingonwhethertheunderlyingplatformsupportsthemandonthecon?gurationchoicesmadeatcompiletime).Italsodocumentsthestandardtypesofthelanguageanditsbuilt-infunctionsandexceptions,manyofwhicharenotorincompletelydocumentedintheReferenceManual.本参考手册罗列并说明了Python标准库的各种功能,以及许多非核心的模组(按不同的操作系统和编译时的设置而定,不是每台机上的Python都能用这些模组.)本手册同时记载了Python语言所有的标准数据类型,内建函数,异常类,这些在参考手册中被忽略了或只是扼要的提过一下.
ThismanualassumesbasicknowledgeaboutthePythonlanguage.ForaninformalintroductiontoPython,seethePythonTutorial;thePythonReferenceManualremainsthehighestauthorityonsyntacticandsemanticquestions.Finally,themanualentitledExtendingandEmbeddingthePythonInterpreterdescribeshowtoaddnewextensionstoPythonandhowtoembeditinotherapplications.
本手册的读者要对Python有基本的认识.初学者应该从Python指南开始.至于Python语言参考手册则是该语言的语法和语义问题上的权威阐释.最后扩展或嵌入Python解释器一文解说了如何在Python中加入新的扩展模组;以及怎样把Python解释器嵌入到其他的应用程式中.
目录
第一章内建对象Built-InObjects
第二章Python运行时服务PythonRuntimeServices2.1main—顶层脚本的运行环境Top-levelscriptenvironment................第三章其他各类服务MiscellaneousServices
第四章普遍的操作系统服务GenericOperatingSystemServices第五章可选配的操作系统服务OptionalOperatingSystemServices第六章互联网通讯协议及其支援InternetProtocolsandSupport
第七章互联网资料处理InternetDataHandling
7.1base64—编码和解码MIMEBase64数据EncodeanddecodeMIMEbase64data.......7.2xml.dom—TheDocumentObjectModel文档对象模式API..................第八章多媒体服务MultimediaServices第九章加密服务CryptographicServices
第十章Python语言服务PythonLanguageServices
第十一章SGIIRIX特定服务SGIIRIXSpeci?cServices
11.1al—SGI的音讯功能AudiofunctionsontheSGI.........................11.2AL—al模组中用到的常数。Constantsusedwiththealmodule................第十二章SunOS特定服务SunOSSpeci?cServices第十三章MSWindows有关的服务MSWindowsServices附录A翻译团队
13357911131314252729313133353739
i
Python库参考手册



