python内置函数大全

所需积分/C币:50 2017-11-17 21:43:27 6.32MB PDF
收藏 收藏 2
举报

python 3.6 library ,详细介绍了每个内置函数的解释以及用法示例。
CONTENTS 1 Introduction 2 Built-in Functions 3 Built-in Constants 27 3. 1 Constants added by the site module 28 4 Built-in Types 4.1 Truth Value Testing 4.2 Boolean operatic 29 4.3 Comparisons 30 4.4 Numeric Types- int, Float, complex 4.5 Iterator Types .36 4.6 Sequence Types- list, tuple, range 37 4.7 Text Sequence Type-str 43 4. 8 Binary Sequence Types- bytes, bytearray, memoryview 4.9 Set Types-set, frozenset 74 4.10 Mapping Types-dict 76 4.11 Context Manager Types 79 4.12 Other Built-in Types 4. 13 Special Attrib 5 Built-in Exceptions 0 86 5.2 Concrete exceptions 86 5.3 Warnings 5.4 Exception h h 3 6 Text Processing Services 6.1 string- CoIllInon string operalions 95 6.2 re- Regular expression operations 105 6.3 difflib- Helpers for computing deltas .125 6.4 textwrap- Text wrapping and filling 135 6.5 lnicodedat a.- Unicode Data base 139 6.6 stringprep- Internet String Preparation 141 6. 7 readline- GNU readline interface 142 6.8 rlcompleter- Completion function for GNU readline 146 7 Binary Data services 149 7.1 struct- Interpret bytes as packed binary data 149 7.2 code Codec registry and base classes 154 8 Data T 8.1 datetime- Basic date and time types 173 8.2 calendar- General calendar-related functions 203 8.3 collections- Container datatypes 206 8.4 collections. abc- Abstract Base Classes for Containers 222 8.5 heapq- Heap queue algorithm 226 8.6 bisect- Array bisection algorithm 8.7 array- Efficient arrays of numeric values 232 8. 8 weakref- Weak references 235 8.9 types- Dynamic type creation and names for built-in types 243 8.10 cop Shallow and deep copy operations 247 8.11 print Data pretty printer 248 8.12 reprlib- Alternate repr( implementation 253 8. 13 enum Support for enumerations .254 9 Numeric and Mathematical Modules 273 9. 1 numbers- Numeric abstract base classes 273 9.2 math- Mathematical functions .276 9.3 cmath- Mathematical functions for complex numbers 9.4 decimal- Decimal fixed point and floating point arithmetic 281 285 9.5 fractions- Rational numbers 312 9.6 random Generate pseudo-random numbers 314 9.7 statistics- Mathernlalical statistics functions 320 10 Functional Programming Modules 327 10.1 itertools- Functions creating iterators for efficient looping 10.2 functools- Higher-order functions and operations on callable objects 340 10.3 operator- Standard operators as functions 347 11 File and Directory Access 355 11.1 pathlib- Object-oriented filesystem paths 11.2 oS path- Common pathname manipulations .371 11.3 fileinput- Iterate over lines from multiple input streams 376 11.4 stat- Interpreting stat( results 378 11.5 filecmp- File and Directory Comparisons 383 11.6 tempfile- Generate temporary files and directories 11.7 glob- Unix style pathname pattern expansion 390 11.8 fnmatch- Unix filename pattern matching 391 119li he- rand cess to text lines 392 11 10 shut.il- High-level file operations 393 ath- Mac os 9 path 401 12 Data Persistence 403 12.1 pickle-Pvthon ob ject 403 12.2 copyreg- Register pickle support functions 416 12.3 shelve Python object persistence .417 12.4 marshal Internal Python object serialization ..419 12.5dbm- Interfaces to unix“ databases” 12.6 sqlite3- 2.0 interface for sQLite databases 425 13 Data Compression and Archiving 445 13.1 lib- CoMpression coMpatible with gzip 445 13.2 gzip- Support for gzip files 449 13.3bz2-S t for bzip2 13.4 lzma- Compression using the LZMA algorithm 451 454 13.5 zipfile- Work with ZIn archives 460 13.6 tarfile- Read and write tar archive files 468 14 File formats 479 14.1 CSV- CSV File Reading and Writing 479 14.2 coIligparser-ConliguralioI file parser 485 14.3 netrc- netrc file processing 503 14.1 xdrlib- Encode and decode XdR data 504 14.5 plistlib- Generate and parse Mac OS X plist files 507 15 Cryptographic Services 511 15.1 hashlib- Secure hashes and message digests 511 15.2 hmac Keyed-Hashing for Message Authentication 15. 3 secrets Generate secure randoIn IluInbers for managing secrets 521 523 16 Generic Operating System Services 527 16.1 os- Miscellaneous operating system interfaces 527 16.2 io Core tools for working with streams 573 16.3 Linle- Time access and conversions .586 16.4 argparse- Parser for command-line options, arguments and sub-commands 594 16.5 getopt- C-style parser for command line options ..625 16.6 logging- Logging facility for Python 628 16.7 logging. config- Logging configuration 643 16.8 logging handlers- Logging handlers 653 16.9 getpass-- Portable password input 666 16.10 curses- Terminal handling for character-cell displays .666 16.11 curses. textpad- Text in put widget for curses programs 684 16.12 curses. ascii Utilities for ASCII characters 686 16.13 curses. panel-A panel stack extension for curses 16 14 platform- Access to underlying platform's identifying data 16. 15 errno- Standard errno system symbols 693 16.16 ctypes- A foreign function library for Python 699 17 Concurrent Execution 17.1 threading- Thread-based parallelism 733 17.2 multiprocessing Process-based parallelism 745 17.3 The concurrent package 788 17.4 concurrent futures- Launching parallel tasks 78 17.5 subprocess- Subprocess management ...794 17.6 sched - Event scheduler 809 17. 7 queue- A synchronized queue class 811 17. 8 dummy threading Drop-in replacement for the threading module 813 17.9 thread Low-level threading API 814 17.10 dumIny Thread- Drop-in replaceMent for the thread Nodule 816 18 Interprocess Communication and Net working 17 18.1 socket- Low-level networking interface 817 8.2 ssl -TLS/ SSL wrapper for socket objects 8.3 select- Waiting for I/O comple 869 18.4 selectors-High-level I/O multiplexing 877 18.5 asyncio Asynchronous I/0, event loop, coroutines and tasks 880 18.6 asynicore- Asynchronous socket handler 18.7 asynchat- Asynchronous socket command /response handler 945 al- Set handlers fo s events 47 18.9 d file support 952 11l 19 Internet Data Handling 19.1 email- An email and MiME handling package 19.2 json- JSON encoder and decoder 1016 19.3 mailcap- Mailcap file handling 1025 19.4 mailbox Manipulate mailboxes in various formats 1026 19.5 mimetypes- Map filenames to MImE types ..1044 19.6 base64- Base16, Base32, Base64, Base85 Data Encodings 1047 19.7 binhex- Encode and decode binhex iles 19.8 binascii-Convert between binary and ASCI 1050 1051 19.9 quopri- Encode and decode mime quoted-printable data 1053 19.10 uu- Encode and decode uuencode files 1054 20 Structured Markup Processing Tools 1055 20.1 html- HyperText Markup Language support 1055 20.2 html parser- Simple HTML and XHTML parser 1055 20.3 html entities- Definitions of HTML general entities 1060 20.4 XMI Processing Modules 1060 20.5 xml etree Element Tree- The Element Tree XML APl .1062 20.6 xml dom- The Document Object Model API 1077 20.7 xml dom. minidom- Minimal DOM implementation 1088 20.8 xml dom. pulldom- Support for building partial DOM trees 1092 20.9 xml. sax Support for SAX2 Parsers 1094 20.10 xInl. sax. handler- Base classes Ior SAX handlers 1096 20.11 xml. sax. saxultiIs- SAX Utilities 20.12 xml. sax. xmlreader- Interface for XML parsers .1102 20.13 xml parsers expat- fast XML parsing using Expat 1106 21 Internet Protocols and Support 1117 21.1 webbrowser- Convenient Web-browser controller 1117 21.2 cgi- Common Gateway Interface support .1119 21.3 cgitb- Trace back manager for CGI scripts 1126 21.4 wsgiref- wSGI Utilities and Reference Implementation 1127 21.5 urllib- URL handling modules 1136 21.6 urllib request- Extensible library for opening urls .1137 21.7 urllib response Response classes used by urllib 1155 21.8 urllib parse- Parse URLS into components 115 21. 9 urllib error- Exception classes raised by urllib request ..1162 21.10 urllib robot parser- Parser for robots. txt 1163 21.11http-httpmodules 1164 21.12http.client-httpprotocolclient 1166 21.13 ftplib-ITP protocol client ...1172 21.14 ib- PoP3 protocol cli 117 21.15 imaplib- IMAP4 protocol client 1180 21.16 nntplib- NNTP protocol client 1187 21 17 smtplib- SMTP protocol client 1194 21.18 smtp- SMTP Server 1200 21.19 telnetlib Telnet client 1204 21.20 uuid- UUID objects according Lo RFC 4122 21.21 socketserver-A framework for net work servers 1210 21.22http.server-httpservers 1218 21.23httpcookies-httpstatemanagement 1223 21.24httpcookiejar-cookiehandlingforHttpclients 1227 21.25 xmlrpc- XMLRPC server and client modules 1236 21.26 xmIrpc client XML-RPC client access .1236 21.27 xmlrpc server- Basic XML-RPC servers 1244 21.28 ipaddress-IPv4/IPv6 manipulation library 1249 22 Multimedia Services 1261 22.1 audioop- Manipulate raw audio data 1261 22.2 ailc- Read and write AiFF and AIFC liles 1264 22.3 sunal- Read and write Sun Au files 1267 22.1 wave- Read and write WAy files 1269 22.5 chunk Read Iff chunked dat a 1272 22.6 colorsvs- Conversions between color systems 1273 22.7 imghdr- Determine the type of an image 1274 22.8 sndhdr- Determine type of sound file 1275 22.9 oSsaudiodev- Access to OSS-compatible audio devices 127 23 Internationalization 1281 23. 1 gettext- Multilingual internationalization services .1281 23.2 locale Internationalization services 1289 24 Progran Frameworks 1297 24.1 turtle- Turtle graphics 1297 24.2 cmd- Supp ort for line-oriented command interpreters 1331 24.3 shlex- Simple lexical analysis ..1336 25 Graphical User Interfaces with Tk 1343 25.1 tkinter- Python interface to Tcl/Tk 1343 25.2 tkinter ttk Tk themed widgets 1354 25.3 kilter. Lix- ExTension widgets for Tk 1371 25.4 tkinter. scrolledtext- Scrolled Text Widget 1376 25.5 IDLE 1377 25.6 Other Graphical User Interface Packages 1385 26 Development Tools 1387 26.1 typing- Support for type hints 1387 26.2 pydoc- Documentation generator and online help system 1402 26.3 doctest- Test inTeractive Python exarnples .1403 26.4 unittest- Unit testing framework 1427 26.5 unittest mock- mock object library 1455 26.6 unittest mock- getting started 1490 26.7 2t03-Automated Python 2 to 3 code translation 1509 26.8 test-Regression tests package for Python 1515 26.9 test support- Utilities for the Python test suite 1518 27 Debugging and Profiling 1525 27.1 bdb- Debugger framework 1525 27.2 faulthandler- Dump the Python traceback 1529 27.3 pdb- The Python Debugger 1532 27.4 The Python Profilers 1538 27.5 timeit- Measure execution time of small code snippets .1546 27.6 trace Trace or track Python statement execution 1551 27.7 Lracenalloc Trace Inleinory allocations 1553 28 Software Packaging and Dist ribution 1563 28.1 distutils- Building and installing Python modules 1563 28.2 ensurepip- Bootstrapping the pip installer 1563 28.3 veny- Creation of virtual environments 1565 28.4 zipapp- Manage executable python zip archives 1574 29 Python Runtime Services 1579 29.1 svs System-specific parameters and functions 1579 29.2 sysconfig- Provide access to Python's configuration information 1594 29.3 builtin- Built-in objects 1598 29.4m main Top-level script environment 1599 29.5 warnings- Warning control 1599 29.6 contextlib- Utilities for with-statement contexts 1604 29.7 abc- Abstract base classes 1615 29.8 atexit- Exit handlers 1620 29.9 traceback- Print or retrieve a stack traceback 1622 29.10 future Future statement definitions 1628 29.11 gc- Garbage Collector interface 1629 29. 12 inspect- Inspect live objects 1632 29.13 site-Site-specific configuration hook .1647 29.14 fpectl- Floating point. exception control 1650 30 Custom Python Interpreters 1653 30.1 code Interpreter base classes 1653 30.2 codeop- CoMpile Python code .1655 31 Importing Modules 1657 31.1 zipimport-lmport modules from Zip archives 1657 31. 2 pkgutil Package extension utility .1659 31.3 modulefinder Find modules used by a script 1662 31.4 runpy- Locating and executing Python modules 1663 31.5 importlib The implementation of import 1665 32 Python Language Services 1685 32.1 parser- Access Python parse trees 1685 32.2 ast- Abstract Syntax Trees 1689 32.3 symtable Access to the compiler's symbol tables 1694 32.4 symbol- Constants used with Python parse trees 1697 32.5 token- Constants used with Python parse trees 1697 32.6 keyword- Testing for Python keywords 1699 32.7 Tokenize- Tokenizer lor Python source 1699 32.8 taban Detection of ambiguous in dentatic 1703 32.9 pyclbr- Python class browser support 1703 32.10 oile- Compile Pyt rce files 1705 32.11 compileall- Byte-compile Python libraries 1706 32.12 dis- Disassembler for Python bytecode 1708 32. 13 pickletools Tools for pickle developers 1721 33 Miscellaneous services 1723 33.1 formatter- Generic out put formatting l723 34 MS Windows Specific Services 1729 34.1 msilib Read and write Microsoft Installer files 1729 34.2 IllsvcrL- Useful rouTines froIn the MS VC++ runtime 1734 34.3 winreg Windows registry access 1736 34.4 winsound- Sound-playing interface for Windows ...1744 35 Unix Specific Services 1747 35.1 posix- The most common POSIX system calls 1747 35.2 pwd- The pass word database 1748 35.3 spwd- The shadow password database 1749 35.4 grp- The group database 1750 35.5 crypt- Function to check Unix passwords 1750 35.6 termios- POSIX style tty control 1752 35.7 tty- Terminal control functions 1753 35.8 pty- Pseudo-terminal utilities .1754 35. 9 ICnul- The IcIlul and ioctl systern calls 1755 35.10 pipes- Interface to shell pipelines 35.11 resource- Resource usage information 1758 35.12 nis-Interface to Sun's NIS (Yellow Pages) 1762 35 13 syslog- Unix syslog library routines 1763 36 Superseded modules 1765 36. 1 optparse- Parser for command line options 1765 36.2 imp- Access the import internals 1792 37 Undocumented modules 1797 37.1 Platform specific modules ..1797 A Glossary 1799 Bibliography 1811 b About these document 1813 B. 1 Contributors to the Python Documentation .1813 C History and License 1815 C 1 History of the software 1815 C 2 Terms and conditions for accessing or otherwise using Python 1816 C 3 Licenses and Acknowledgements for Incorporated Software 1819 D Copyright Python Module Index 1835 Index 18

...展开详情
试读 127P python内置函数大全
立即下载 低至0.43元/次 身份认证VIP会员低至7折
    一个资源只可评论一次,评论内容不能少于5个字
    暮月七 官方文档,更想看自己整理的
    2019-03-06
    回复
    关注 私信 TA的资源
    上传资源赚积分,得勋章
    最新推荐
    python内置函数大全 50积分/C币 立即下载
    1/127
    python内置函数大全第1页
    python内置函数大全第2页
    python内置函数大全第3页
    python内置函数大全第4页
    python内置函数大全第5页
    python内置函数大全第6页
    python内置函数大全第7页
    python内置函数大全第8页
    python内置函数大全第9页
    python内置函数大全第10页
    python内置函数大全第11页
    python内置函数大全第12页
    python内置函数大全第13页
    python内置函数大全第14页
    python内置函数大全第15页
    python内置函数大全第16页
    python内置函数大全第17页
    python内置函数大全第18页
    python内置函数大全第19页
    python内置函数大全第20页

    试读已结束,剩余107页未读...

    50积分/C币 立即下载 >