您好,欢迎访问三七文档
当前位置:首页 > IT计算机/网络 > 数据库 > Python库参考手册
Python(PythonLibraryReference)Release2.3.3GuidovanRossumFredL.Drake,Jr.,editor::2004322PythonLabsEmail:docs@python.orgCopyrightc°2001,2002,2003PythonSoftwareFoundation.Allrightsreserved.Copyrightc°2000BeOpen.com.Allrightsreserved.Copyrightc°1995-2000CorporationforNationalResearchInitiatives.Allrightsreserved.Copyrightc°1991-1995StichtingMathematischCentrum.Allrightsreserved.Seetheendofthisdocumentforcompletelicenseandpermissionsinformation..Pythonisanextensible,interpreted,object-orientedprogramminglanguage.Itsupportsawiderangeofapplica-tions,fromsimpletextprocessingscriptstointeractiveWebbrowsers.Python,,.,.WhilethePythonReferenceManualdescribestheexactsyntaxandsemanticsofthelanguage,itdoesnotdescribethestandardlibrarythatisdistributedwiththelanguage,andwhichgreatlyenhancesitsimmediateusability.Thislibrarycontainsbuilt-inmodules(writteninC)thatprovideaccesstosystemfunctionalitysuchasfileI/OthatwouldotherwisebeinaccessibletoPythonprogrammers,aswellasmoduleswritteninPythonthatprovidestandardizedsolutionsformanyproblemsthatoccurineverydayprogramming.SomeofthesemodulesareexplicitlydesignedtoencourageandenhancetheportabilityofPythonprograms.PythonPython.Python.Python.C,,;Python,.Python.ThislibraryreferencemanualdocumentsPython’sstandardlibrary,aswellasmanyoptionallibrarymodules(whichmayormaynotbeavailable,dependingonwhethertheunderlyingplatformsupportsthemandontheconfigurationchoicesmadeatcompiletime).Italsodocumentsthestandardtypesofthelanguageanditsbuilt-infunctionsandexceptions,manyofwhicharenotorincompletelydocumentedintheReferenceManual.Python,(,Python.)Python,,,.ThismanualassumesbasicknowledgeaboutthePythonlanguage.ForaninformalintroductiontoPython,seethePythonTutorial;thePythonReferenceManualremainsthehighestauthorityonsyntacticandsemanticquestions.Finally,themanualentitledExtendingandEmbeddingthePythonInterpreterdescribeshowtoaddnewextensionstoPythonandhowtoembeditinotherapplications.Python.Python.Python.PythonPython;Python.Built-InObjects1PythonPythonRuntimeServices32.1main—Top-levelscriptenvironment................3MiscellaneousServices5GenericOperatingSystemServices7OptionalOperatingSystemServices9InternetProtocolsandSupport11InternetDataHandling137.1base64—MIMEBase64EncodeanddecodeMIMEbase64data.......137.2xml.dom—TheDocumentObjectModelAPI..................14MultimediaServices25CryptographicServices27PythonPythonLanguageServices29SGIIRIXSGIIRIXSpecificServices3111.1al—SGIAudiofunctionsontheSGI.........................3111.2AL—alConstantsusedwiththealmodule................33SunOSSunOSSpecificServices35MSWindowsMSWindowsServices37A39iiiBuilt-InObjectsNamesforbuilt-inexceptionsandfunctionsandanumberofconstantsarefoundinaseparatesymboltable.Thistableissearchedlastwhentheinterpreterlooksupthemeaningofaname,solocalandglobaluser-definednamescanoverridebuilt-innames.Built-intypesaredescribedtogetherhereforeasyreference.12Thetablesinthischapterdocumenttheprioritiesofoperatorsbylistingtheminorderofascendingpriority(withinatable)andgroupingoperatorsthathavethesamepriorityinthesamebox.Binaryoperatorsofthesameprioritygroupfromlefttoright.(Unaryoperatorsgroupfromrighttoleft,butthereyouhavenorealchoice.)Seechapter5ofthePythonReferenceManualforthecompletepictureonoperatorpriorities.()()Python51Mostdescriptionssorelylackexplanationsoftheexceptionsthatmayberaised—thiswillbefixedinafutureversionofthismanual.2—12PythonPythonRuntimeServicesThemodulesdescribedinthischapterprovideawiderangeofservicesrelatedtothePythoninterpreteranditsinteractionwithitsenvironment.Here’sanoverview:PythonmainTheenvironmentwherethetop-levelscriptisrun.2.1main—Top-levelscriptenvironmentThismodulerepresentsthe(otherwiseanonymous)scopeinwhichtheinterpreter’smainprogramexecutes—commandsreadeitherfromstandardinput,fromascriptfile,orfromaninteractiveprompt.Itisthisenvironmentinwhichtheidiomatic“conditionalscript”stanzacausesascripttorun:()–,,.“”,main.if__name__==__main__:main()34MiscellaneousServicesThemodulesdescribedinthischapterprovidemiscellaneousservicesthatareavailableinallPythonversions.Here’sanoverview:Python.:56GenericOperatingSystemServicesThemodulesdescribedinthischapterprovideinterfacestooperatingsystemfeaturesthatareavailableon(al-most)alloperatingsystems,suchasfilesandaclock.TheinterfacesaregenerallymodeledaftertheUNIXorCinterfaces,buttheyareavailableonmostothersystemsaswell.Here’sanoverview:UNIXC78OptionalOperatingSystemServicesThemodulesdescribedinthischapterprovideinterfacestooperatingsystemfeaturesthatareavailableonselectedoperatingsystemsonly.TheinterfacesaregenerallymodeledaftertheUNIXorCinterfacesbuttheyareavailableonsomeothersystemsaswell(e.g.WindowsorNT).Here’sanoverview:UNIXC,Windows,NT:910InternetProtocolsandSupportThemodulesdescribedinthischapterimplementInternetprotocolsandsupportforrelatedtechnology.TheyareallimplementedinPython.Mostofthesemodulesrequirethepresenceofthesystem-dependentmodulesocket,whichiscurrentlysupportedonmostpopularplatforms.Hereisanoverview:,Pythonsocket1112InternetDataHandlingThischapterdescribesmoduleswhi
本文标题:Python库参考手册
链接地址:https://www.777doc.com/doc-3781865 .html