Python api函数手册

所需积分/C币:17 2018-08-22 10:42:07 4.46MB PDF
收藏 收藏 3
举报

Python api函数手册
CONTENTS 1 Introduction 3 2 Built-in functions 3 Non-essential Built-in Functions 23 4 Built-in Constants 25 4.1 Constants added by the site module 5 Built-in Types 5.1 Truth Value Testing 5.2 Boolean Operations-and,or, not 5.3 Comparisons 28 5.4 Numeric Types-int, =lca=, Icnc, complex.... 28 5.5 Iterator Types 5.6 Sequence types- str, unicode, list, tuple, buffer, xrange 31 5.7 Set Types-set, frozenset 5.8 Mapping Types-dict 5.9 File Objects 45 5.10 Context Manager Types 5.11 Other Built-in Types 49 5.12 Special Attributes 51 6 Built-in Exceptions 6.1 Exception hierarchy ..57 7 String Services 59 7.1 string- Common string operations 7.2 re- Regular expression operations 70 7.3 struct- Interpret strings as packed binary data 7.4 difflib- Helpers for computing deltas 88 7.5 Stringl0- Read and write strings as files .97 7.6 cStringIo- Faster version of stringIC 7.7 text wrap- Text wrapping and filling 7.8 codecs-Codec registry and base classes 10 7.9 uniccdedata- Unicode Database 114 7.10 stringprep-Internet String Preparation 116 7.11 fpformat- Floating point conversions 117 8 Data types l19 8.1 datetime -Basic date and time ty pes 119 8.2 calendar- General calendar-related functions 140 8.3 collec=- High-performance container datatypes 8.4 heapq- Heap queue algorithm 8.5 bisect Array bisection algorithm 154 8.6 array- Efficient arrays of numeric values 8.7 sets- Unordered collections of unique elements 158 8.8 sched- Event scheduler 161 8.9 mutex- Mutual exclusion support ,,.163 8.10 queue-A synchronized queue class 163 8.1 weakref- Weak references 165 8.12 UserDict -Class wrapper for dictionary objects 8.13 UserList- Class wrapper for list objects 170 8.14 UserString- Class wrapper for string objects 170 8.15 types- Names for built-in types .171 8.16 new- Creation of runtime internal objects 173 8.17 copy- Shallow and deep copy operations .174 8.18 print- Data pretty printer 175 8.19 Alternate epr()implementation 177 9 Numeric and mathematical modules 181 9.1 numbers Numeric abstract base classe 9.2 math-Mathematical functions 184 9.3 cmath- Mathematical functions for complex numbers 9. 4 decimal- Decimal fixed point and floating point arithmetic 189 9.5 fractions- Rational numbers 9.6 random-Generate pseudo-random numbers 213 .7 itertcols- Functions creating iterators for efficient looping 216 9.8 functcols- Higher order functions and operations on callable objects 9.9 operator- Standard operators as functions ..230 10 File and Directory Access 237 10.1 os. path-Common pathname manipulations 10.2 fileinput- Iterate over lines from multiple input streams 240 10.3 stat-Interpreting stat() results .242 10.4 statyfs-Constants used with cs. statvfs( 245 10.5 fi lecmp-File and Directory Comparisons 245 10.6 tempfile- Generate temporary files and directories 0.7 glob- Unix style pathname pattern expansion ..250 10.8 fnmatch- Unix filename pattern matching 250 10.9 inecache- Random access to text lines 10.10 shutil- High-level file oper rations 10.11 dircache Cached directory listings 254 10.12 macpath- Mac os 9 path manipulation functions 11 Data persistence 257 11.1 pickle- Python object serialization ........... 257 11.2 CPick⊥e- A faster pick⊥e.., 1 1.3 copy_reg-Register pick le support functions 267 1. 4 she ve- Python object persistence 267 11.5 marshal-Internal Python object serialization 269 11.6 anydbm-Generic access to DBM-style databases 271 11.7 whichdb-Guess which DBM module created a database 11.8 abm- Simple database"interface .272 11.9 gabm-GNU's reinterpretation of dbm 11. 10 dbhash- DBM-style interface to the bsd database library 274 11.Il bsddb- Interface to Berkeley DB library 275 11 12 dumhcbm-Portable DBM implementation .277 11.13 sqlite3-DB-API 2.0 interface for SQLite database 278 12 Data Compression and Archiving 2 2.1 7.1i b- Compression compatible with gzip 12.2 gz. i- Support for gzip files 297 12.3 bz2-Compression compatible with bzip2 12.4 zipfile- Work with ZIP archives 12.5 tarfile- Read and write tar archive files 305 13 File formats 313 13.1 CSv- CSV File Reading and Writing 313 13.2 ConfigParser-Configuration file parser 319 13.3 robotparser -Parser for robots.Lxt 13.4 netrc- netrc file processing 13.5 xdrlib- Encode and decode Xdr data 13.6 plistlib- Generate and parse Mac OSX. plist files 326 329 14 Cryptographie Services 331 14.1 hashlib- Secure hashes and message digests 331 14.2 hmac-Keyed-Hashing for Message Authentication 14.3 md5-MD5 message digest algorithm 333 14.4 sha- SHA-I message digest al 15 Generic Operating System Services 335 15.1 OS Miscellaneous operating system interfaces ,.335 15.2 io- Core tools for working with streams 15.3 time- Time access and conversions 15.4 optparse-More powerful command line option parser 370 15.5 getopt-Parser for command line options 393 15.6 Logging- Logging facilit non 395 15.7 getpass- Portable password input........... 42 15.8 curses- Terminal handling for character-cell displays 15.9 curses.textpad- Text input widget for curses programs, 430 44 15.10 curses. wrapper- Terminal handler for curses programs 15. I1 curses. ascii-Utilities for ASCiI characters .445 15.12 curses.panel-A panel stack extension for curses 447 15.13 plat- Access to underlying platform's identifying data 449 15.14 errnc- Standard errno system symbols 451 15.15 ctvpes-A foreign function library for Python 457 16 Optional Operating system Services 487 16.1 select- Waiting for 1/0 completion .487 16.2 threading- Higher-level threading interface ,.,.491 16.3 thread- Multiple threads of control 16.4 dummy_ -hreading-Drop-in replacement for the threading module ......501 16.5 dummy -hread- Drop-in replacement for the thread module 16.6 multiprocessing- Process-based"threading" interface 502 16.7 mmap Memory-mapped file support 547 16.8 readlire-GNU readline interface 550 16.9 rlcompleter-Completion function for GNU readline 17 Interprocess Communication and Networking 555 17.1 subprocess- Subprocess management 17.2 socket -Low-level networking interface 17.3 ssl-SSL wrapper for socket objects 571 17. 4 signal- Set handlers for asynchronous events 17.5 popen2-Subprocesses with accessible I/O streams 581 17.6 asynccre- Asynchronous socket handler 17.7 asynchat- Asynchronous socket command/response handler 18 Internet Data Handling 591 18.1 email-An email and MIMe handling package .591 18.2 json-JSON encoder and decoder 619 18.3 mailcap- Mailcap file handling .624 18.4 mailbox-Manipulate mailboxes in various formats 625 18.5 nhlir-Access to Mh mailboxes 18.6 nmimetcols-Tools for parsing MIME messages 644 8.7 mimetypes Map filenames to MIME types 18.8 MimeWriter- Generic MIME file writer 18.9 minify- MIME processing of mail messages 648 8. 10 multifile- Support for files containing distinct parts 649 18.11 rfc822-Parse RFC 2822 mail headers 651 18.12 base64-RFC 3548: Base 16 Base 32 Base64 Data Encodings 654 18.13 binhex -Encode and decode binhex 4 files 656 18.14 binascii- Convert between binary and AscI .657 18.15 quopri- Encode and decode mime quoted-printable data 18 16 uu- Encode and decode uuencode files 19 Structured Markup Processing Tools 661 19.1 HTMIParser-Simple HTML and XHTML parser 661 19.2 sgmllib- Simple SGML parser .663 19.3 htmllib-A parser for HTML documents .665 19. 4 htmlenzit fs- Definitions of HTML general entities 19.5 xml parsers expat -Fast XMI, parsing using Expat 19.6 xml dom- The Document Object Model APl 675 19.7 xml dcm minicom- Lightweight DOM implementation 685 19.8 xml dcm. oulldom- Support for building partial DOM trees .689 19.9 xml. sax- Support for SAX2 parsers .689 19.10 xml, sax. handler- Base classes for SAX handlers ..691 19.11 xml. sax. saxutils-SAX Utilities 695 19.12 xml. sax. xmlreader-Interface for XML parsers .695 19.13 xml etree. flement Tee- The ElementTree XML Apt 699 20 Internet Protocols and Support 707 20.1 webbrowser- Convenient Web-browser controller .707 20.2 cgi- Common Gateway Interface support 709 0.3 cgith-Traceback manager for CGil scripts 715 20.4 wsgiref-wSGI Utilities and Reference Implementation .716 20.5 urllib-Open arbitrary resources by URL ..724 20.6 urllib2- extensible library for opening URLS 20.7httplib-httpprotocolclient 739 20.8 ftplib-FTP protocol client 743 20.9 poplib-POP3 protocol client 746 20.10 imaplib-IMAP4 protocol client 748 20.1I nntplib-NNTP protocol client 753 20.12 smtplib-SMTP protocol client 757 20.13 smtpd-SMTP Server 761 20.14 telnetlio- Telnet client 20. 15 uuid- UUID objects according to RFC 4122 20. 16 urlparse- Parse URLs into components 767 20.17 Socketserver-a framework for network servers 770 20.18baSehttpserver-basichttpserver 777 20.19simplehttpServer-simpleHttprequesthandler 20.20 CgihtTe seRver-cgi-CapabLe htTp request handler 781 20.21cookielio-cookiehandlingforhttpclients 20.22Cookie-httpstatemanagement .789 20.23 xmlrpclio- XML-RPC client access 20.24 SimpleXMLRPCServer- Basic XML-RPC server 800 20.25 DOCXMLRPCServer- Self-documenting XML-RPC server 803 21 Multimedia services 805 21.1 audiccp- Manipulate raw audio data 21.2 imagecp- Manipulate raw image data .808 21.3 aiEc- Read and write alff and alfc files 809 21. 4 suna- Read and write Sun Au files 811 21.5 wave- Read and write Wav files 813 21.6 chunk- Read IFF chunked data 815 21.7 colorsys- Conversions between color systems ,..816 21. 8 imghdr- Determine the type of an image 817 21.9 sndhdr -Determine type of sound file 8l7 21.10 ossaudiodev- Access to OSS-compatible audio devices 818 22 Internationalization 823 22.1 getter=- Multilingual internationalization services 823 22.2 locale-Internationalization services .83 23 Program Frameworks 839 23. 1 cmd- Support for line-oriented command interpreters 39 23. 2 shlex- Simple lexical analysi 841 24 Graphical User Interfaces with Tk 845 24.1 Tkinter- Python interface to Tcl/Tk .845 24.2 Tix- Extension widgets for tk ,.854 24.3 ScrolledText- Scrolled Text Widget 24.4 turtle-Turtle graphics for Tk ...,.859 24.5 IDLE 24.6 Other Graphical User Interface Packages 890 25 Development Tools 893 25.1 pydoc- Documentation generator and online help system 893 25.2 doctes--Test interactive Python examples 894 25.3 unittest- Unit testing framework 915 25. 4 2to3- Automated Python 2 to 3 code translation .926 25. 5 test-Regression tests package for Python .,,,,,930 25.6 test. test support- Utility functions for tests .932 26 Debugging and Profiling 935 26.1 bdb- Debugger framework 935 26.2 pdb- The Python Debugger 939 26.3 Debugger Commands .940 26. 4 The Python Profilers .943 26.5 hot shc=- High performance logging profiler 26.6 timeit- Measure execution time of small code snippets 26.7 trace- Trace or track Python statement execution 954 27 Python Runtime Services 957 27. 1 sys- System-specific parameters and functions .957 27.2buil-in_- Built-in objects 966 27.3 future builtins-Python 3 builtins 967 274 maIn Top-level script environment 967 27.5 warnings- Warning control 968 27.6 texclib-Utilities for with-statement contexts .972 27.7 abc- Abstract Base Classes 973 27.8 atexit- Exit handlers 279 traceback- Print or retrieve a stack traceback 27.10 Future Future statement definitions 980 27.11 gc-Garbage 98 27.12 inspec=-Inspect live objects 983 27.13 site- Site-specific configuration hook 27 14 user-User-specific configuration hook 989 27. 15 fpectl- Floating point exception control 990 27 16 distutils- Building and installing Python modules 991 28 Custom Python Interpreters 28.1 code-Interpreter base classes 28.2 codec- Compile Python code 99 29 Restricted Execution 9.1 rexec- Restricted execution framework 29.2 Bastion- Restricting access to objects 1000 30 Importing Modules 1003 30. Access the import internals 30.2 imputil-Import utilities l006 30.3 zipirport-Import modules from Zip archives ...1009 30.4 pkgutil- Package extension utility ,,,,,,,,1011 30.5 modulefinder Find modules used by a script........................1012 30.6 runpy- Locating and executing Python modules 1013 31 Python Language services 1015 31.1 parser- Access Python parse trees 1015 31.2 Abstract Syntax Trees ,,1023 31.3 symtable-Access to the compiler's symbol tables.................... 1028 31.4 symbc1-Constants used with Python parse trees 1030 31.5 token- Constants used with Python parse trees .1030 31.6 keyword- Testing for Python keywords 1031 31.7 tokenize-Tokenizer for Python source 1031 31.8 tabnanry-DetecLion of ambiguous indentation 1032 31.9 pyclbr-Python class browser support....... 1033 31.10 py compile- Compile Python source files............... 1034 31.11 compileall- Byte-compile Python libraries .1034 31.12 dis- Disassembler for Python bytecode 1035 31.13 picklerool s-Tools for pickle developers 1042 32 Python compiler package 1045 32.1 The basic interface 1045 32.2 Limitations 1046 32.3 Python Abstract Syntax l046 32.4 Using visitors to walk asts 1050 32.5 Bytecode Generation .1051 33 Miscellaneous Services 1053 33.1 formatter- Generic output formatting 1053 34 MS Windows Specific Services 1057 34.1 msilib- Read and write microsoft Installer files ,,,.1057 34.2 msvcrt- Useful routines from the ms vc+t runtime 1062 34.3_- Windows registry access 1063 34.4 winsourd- Sound-playing interface for Windows 1070 35 Unix Specific Services 1073 35.1 posix- The most common PosIX system calls .1073 35.2 pwd- The pass word database ,,1074 35.3 spwd- The shadow password database 1074 35.4 grp- The group database ...l075 35.5 crypt- Function to check Unix pass words 1076 35.6 dl-Call C functions in shared objects 1076 35.7 termi POSIX style tty control 1077 35.8 tty- Terminal control functions 1078 35.9 pty- Pseudo-terminal utilities 1079 35.10 fcntl-The fcntl()and ioctl() system calls 1079 35.11 pipes- Interface to shell pipelines l081 35. 12 posixfile-File-like objects with locking support 1082 35.13 resource-Resource usage information ....1084 35. 14 nis- Interface to Suns NIS (Yellow Pages) 1086 35.15 syslog- Unix syslog library routines 1087 35.16 commands- Utilities for running commands 1087 36 Mac Os X specific services 1089 36.1 ic- Access to the Mac Os X Internet Conlig 1089 363 macoto18- Convenience routines for file manipulation:·‘·.、" 36.2 Maccs- Access to Mac OS interpreter features ,,,,1090 1091 36.4 finder-ools- The finders Apple Events interface 1092 36.5 FasyDi- Basic Macintosh dialogs 1093 36.6 Frame- Interactive application framework 1095 36.7 autoGIL-Global Interpreter Lock handling in event loops 1098 36.8 Mac OS Toolbox modules 1098 36.9 Colorpicker- Color selection dialog 1104 37 MacPython OSA Modules 1105 37.1 gensui cemodule-Generate OSA stub packages l106 37.2 aetocls OSA client support l106 37.3 aepack-Conversion between Python variables and Apple Event dala containers l107 37.4 aet ypes- AppleEvent objects . 1108 37.5 MiniAEFrame-Open Scripting Architecture server support 1110 38 SGIIRIX Specific Services 1111 38.1 al- Audio functions on the sgi .,,,,1l11 38.2 AL- Constants used with the al module 1113 38.3 cd- CD-ROM access on SGI systems 1113 38.4 f1- FORMS library for graphical user interfaces 1116 38.5 FI- Constants used with the fl module 1121 38.6 flp- Functions for loading stored FORMS designs 1121 38.7f nterface 1121 38.8 gI- Graphics Library interface I22 38.9 DEVICE-Constants used with the gl module 1124 38.10 GL- Constants used with the gl module I24 38.11 imgfile- Support for SGI imglib files 1124 38.12 ipeg-Read and write JPEG files 39 SunOS Specific Services 1127 39.1 sunaudiodev- Access to Sun audio hardware ..1127 39.2 SUNAUDIODEV- Constants used with sunaudiodev 1128 40 Undocumented modules 1129 40.1 Miscellaneous useful utilities 1129 40.2 Platform specific modules 1129 40.3 Multimedia .,,,.1129 40.4 Undocumented mac os modules l129 40.5 Obsolete 1l31 40.6 SGI-specific Extension modules A Glossa 1133 Bibliography 1139 b About these documents 1141 B.1 Contributors to the python documentation 1141 C History and License 1143 C 1 History of the software 1143 C 2 Terms and conditions for accessing or otherwise using Python 1144 C3 Licenses and Acknow ledgements for Incorporated Software 1146 D Copyright 1155 Module index 1157 Index 1161

...展开详情
试读 127P Python api函数手册
立即下载 低至0.43元/次 身份认证VIP会员低至7折
抢沙发
一个资源只可评论一次,评论内容不能少于5个字
关注 私信 TA的资源
上传资源赚积分,得勋章
最新推荐
Python api函数手册 17积分/C币 立即下载
1/127
Python api函数手册第1页
Python api函数手册第2页
Python api函数手册第3页
Python api函数手册第4页
Python api函数手册第5页
Python api函数手册第6页
Python api函数手册第7页
Python api函数手册第8页
Python api函数手册第9页
Python api函数手册第10页
Python api函数手册第11页
Python api函数手册第12页
Python api函数手册第13页
Python api函数手册第14页
Python api函数手册第15页
Python api函数手册第16页
Python api函数手册第17页
Python api函数手册第18页
Python api函数手册第19页
Python api函数手册第20页

试读结束, 可继续阅读

17积分/C币 立即下载 >