Directory of Python reference manuals

Source: Internet
Author: User
Tags error handling generator semaphore

The first part: Python language

1th: Python Introduction------2

1.1 Run the PY------21.2 variables and operator expressions------31.3-piece statement------51.4 file Input Output------61.5 string------71.6 list------81.7 Yuan zu------91.8 Collection------101.9 Dictionary------111.10 iterations and loops------121.11 functions------131.12 generator------141.13 ctrip------151.14 objects and classes------161.15 Exception------171.16 module------181.17 Get help------19 2nd: Syntax Conventions and syntax------20

2.1 Line structure and indentation------202.2 identifier and reserved word------212.3 numeric literal------212.4 string literal------222.5 container------232.6 operator, delimiter and special symbol------242.7 Document string------242.8 adorner------242.9 Source code------25 3rd: Type and Object------26

3.1 Terms------263.2 the identity and type of the object------263.3 reference count and garbage collection------273.4 references and assignments------283.5 the first class of objects------293.6 represents the built-in type of the data------303.6.1 The None type------303.6.2 numeric type------313.6.3 sequence type------313.6.4 mapping type------353.6.5 collection type------363.7 represents the built-in type of the program structure------383.7.1 Callable types------383.7.2 class, type and instance------403.7.3 module------413.8 The built-in type used inside the interpreter------413.8.1 code object------413.8.2 Frame Object------423.8.3 The Trace object------The 423.8.4 Builder object------The 433.8.5 Slice object------433.8.6 Ellipsis object------433.9 object behavior and special methods------443.9.1 object creation and destruction------443.9.2 object String representations------443.9.3 to compare and sort------453.9.4 type check------463.9.5 Property access------463.9.6 Property wrapping and descriptor------463.9.7 sequence and mapping method------473.9.8 iterative------483.9.9 Mathematical operations------483.9.10 Callable Interface------503.9.11 Context Management Protocol------503.9.12 Object Check with Dir ()------51 Chapter 4th: Operators and expressions------52

4.1 Numeric operations------524.2 Sequence Operations------534.3 string Formatting------564.4 Advanced String Formatting------574.5 Dictionary operation------594.6 set operation------604.7 Incremental replication------604.8 properties (.) operator------614.9 function call () operator------614.10 conversion function------614.11 Boolean expression with truth------624.12 object Equality and identity------634.13 operation priority------634.14 Conditional expression------64

The 5th Chapter: Program Structure and control flow------65

5.1 Program structure and execution------655.2 execution Condition statement------655.3 Loop and Iteration------665.4 exception------685.4.1 built-in exception------705.4.2 defines a new exception------715.5 Context Manager and with statement------725.6 assertion with __debug__------73

The 6th chapter: function and function programming------75

6.1 function------756.2 parameter is passed with the return value------776.3 Scope rule------786.4 function as object and closure------796.5 adorner------826.6 generator with yield------836.7 The Association and Yield expressions------856.8 using the generator and the------876.9 list deduction------896.10 Generator expression------906.11 declarative programming------916.12 Lambda The operator------926.13 recursively------926.14 document strings------936.15 function Properties------946.16 eval (), exec (), and compile () functions------94

The 7th Chapter: Class and Object-oriented programming------96

The 7.1 class statement------class 967.2 instances------977.3 Scope rules------977.4 inheritance------987.5 polymorphic dynamic bindings and Duck types------1007.6 static methods and class methods------1017.7 Attribute------1027.8 Descriptor------1047.9 data encapsulation and private properties------1057.10 Object Memory Management------1067.11 object representations and property bindings------1087.12 Slots------1097.13 operator overloads------1107.14 types and Class members test------1117.15 Abstract base class------1137.16-Tuple class------1147.17 class Adorner------117

8th: module, Package and distribution------118

8.1 Module and import statement------1188.2 imports the selected symbol from the module------1198.3 executes as the main process------1208.4 module Search path------1218.5 module load and compile------1218.6 Module reload and unload------1228.7 package------1238.8 Distribute Python programs and libraries------1258.9 install third-party libraries------127

The 9th chapter: input and output------129

9.1 Read command-line options------1299.2 Environment variables------1309.3 files and file objects------1309.4 standard input, output, and error------1339.5 Print Statements------1339.6 print () The function------1349.7 text output------1349.8 generation output------1359.9 Unicode string processing------1369.10 Unicode character attribute------1379.10.1 Unicode Data encoding------1389.10.2 Unicode character attribute------1409.11 object persistence with pickle module------140

10th: Implementation of the environment------142

10.1 Interpreter options and environment------14210.2 Interactive reply------14410.3 launch Python application------14510.4 site profile------14510.5 User Site package------14610.6 Enable new features------14610.7 program termination------147 11th: Testing, commissioning, probing and tuning------149

11.1 Document strings and Doctest modules------14911.2 Unit Test and UnitTest module------15111.3 python Debugger and PDB module------15311.3.1 Debugger Commands------15311.3.2 Debugging from the command line------15611.3.3 Configuration Debugger------15611.4 profiling------15611.5 tuning and optimizing------15711.5.1 for timing measurements------15711.5.2 Memory measurement------15811.5.3 disassembly------15811.5.4 Tuning Strategy------159 Part Two: Python library------164

12th chapter: Built-in functions and exceptions------164

12.1 Built-in functions and types------17212.2 built-in exceptions------17212.2.1 exception base class------17312.2.2 predefined Exception class------17312.3 built-in warning------17612.4 future_ Builtins------176

13th: Python Runtime service------178

13.1 atexit------17813.2 copy------17813.3 GC------17913.4 inspect------18013.5 Marshal------18313.6 Pickle------18413.7 SYS------18613.7.1 variable------18613.7.2 function------18913.8 traceback------19113.9 types------19213.10 Warnings------19313.11 WEAKREF------19513.11.1 Example------19613.11.2 NOTE------196

The 14th chapter: Mathematical Calculation------197

14.1 decimal------19714.1.1 Decimal Object------19714.1.2 Context object------19814.1.3 functions and constants------20014.1.4 Example------20114.1.5 NOTE------20214.2 fractions------20314.3 math------20414.4 numbers------20514.5 Random------20614.5.1 seed and initialization------20614.5.2 random integer------20614.5.3 random sequence------20714.5.4 real value randomly distributed------20714.5.5 Note------208

15th Chapter: Data structure, algorithms, and code simplification------209

15.1 ABC------20915.2 array------21015.3 bisect------21215.4 Collections------21315.4.1 deque and defaultdict------21315.4.2 named progenitor------21415.4.3 Abstract base class------21615.5 contextlib------21715.6 functools------21815.7 HEAPQ------21915.8 itertools------22015.9 operator------222

16th Chapter: string and Text processing------225

16.1 codecs------22516.1.1 Low Codecs interface------22516.1.2 I/O related functions------22616.1.3 useful constants------22716.1.4 Standard encoding------22716.1.5 NOTE------22816.2 re------22816.2.1 mode syntax------22816.2.2 function------22916.2.3 Regular expression------23116.2.4 Match object------23116.2.5 example------23216.2.6 NOTE------23316.3 string------23316.3.1 constant------23316.3.2 Formatter Object------23316.3.3 Template string------23516.3.4 utility function------23516.4 struct------23516.4.1 packaging and unpacking functions------23616.4.2 Struct object------23616.4.3 Format encoding------23616.4.4 NOTE------23716.5 unicodedata------238

17th: Python Database access------241

17.1 relational database API specification------24117.1.1 connection------24117.1.2 Cursor------24217.1.3 Build Query------24317.1.4 type Object------24417.1.5 Error handling------24517.1.6 Multi-threaded------24517.1.7 Map The results to a dictionary------24617.1.8 database API extension------24617.2 sqlite3 module------24617.2.1 Module-level functions------24617.2.2 Connection objects------24817.2.3 cursors and basic operations------25017.3 DBM-style database modules------25217.4 shelve modules------253

18th: File and directory processing------254

18.1 bz2------25418.2 filecmp------25518.3 fnmatch------25618.4 glob------25718.5 gzip------25718.6 Shutil------25818.7 tarfile------25918.7.1 Exception------26118.7.2 example------26218.8 tempfile------26218.9 ZipFile------26318.10 zlib------266

19th: Operating System services------268

19.1 Commands------26819.2 Configparaer, configparser------26919.2.1 Configparaer class------26919.2.2 example------27019.2.3 NOTE------27219.3 datetime------27219.3.1 Date Object------27219.3.2 Time Object------27319.3.3 DateTime object------27419.3.4 The Timedelta object------27519.3.5 A mathematical operation involving dates------27619.3.6 Tzinfo object------27719.3.7 Date and time resolution------27819.4 errno------27819.4.1 POSIX Error code------27819.4.2 Windows Error code------27919.5 FCNTL------28019.5.1 Example------28119.5.2 Note------28119.6 IO------28219.6.1 Basic I/O interface------28219.6.2 raw I/o------28219.6.3 cache binary I/o------28319.6.4 text i/ O------28519.6.5 Open () function------28519.6.6 abstract base class------28619.7 logging------28619.7.1 Logging Level------28619.7.2 Basic configuration------28619.7.3 Logger object------28819.7.4 Processor object------29219.7.5 message formatting------29419.7.6 Various utility functions------29619.7.7 Logging configuration------29619.7.8 Performance Considerations------29919.7.9 NOTE------29919.8mmap------29919.9 MSVCRT------30119.10 Optparse------30319.10.1 Example------30519.10.2 NOTE------30619.11 OS------30719.11.1 Process Environment------30719.11.2 File creation and file descriptor------30919.11.3 Files and directories------31319.11.4 Process Management------31619.11.5 System Configuration------32019.11.6 exception------32119.12 os.path------32119.13 signal------32319.13.1 Example------32519.13.2 NOTE------32519.14 subprocess------32519.14.1 Example------32719.14.2 NOTE------32819.15 Time------32819.16 winarg------330

Chapter 20th Threading and concurrency------334

20.1 Basic concepts------33520.2 concurrent programming with python------33620.3 multiprocessing------33620.3.1 process------33620.3.2 interprocess communication------33720.3.3 Pool------34320.3.4 shared data and synchronization------34520.3.5 managed Objects------34720.3.6 connection------35220.3.7 Various utility functions------35320.3.8 general recommendations for multi-process processing------35320.4 Threading------35420.4.1 Thread Object------35420.4.2 Timer Object------35620.4.3 Lock Object------35620.4.4 Rlock object------35620.4.5 semaphore with bounded semaphore------35720.4.6 event------35820.4.7 The condition variable------35820.4.8 uses lock------35920.4.9 Thread termination with hang------36020.4.10 utility function------36120.4.11 Global interpreter lock------36120.4.12 Using thread programming------36120.5 queue, queue------36220.6 and micro-threading------364

The 21st Chapter: Network Programming and socket------365

21.1 Network Programming foundation------36521.2 asynchat Module------36721.3 asyncore module------37021.4 SELECT------37421.4.1 Advanced module features------37521.4.2 advanced asynchronous I/O example------timing of 37521.4.3 Asynchronous networking------38121.5 Select------38321.5.1 Address family------38321.5.2 Socket type------38321.5.3 addressing------38421.5.4 function------38521.5.5 exception------39521.5.6 example------39521.5.7 NOTE------39621.6 SSL------39621.7 socketserver------39921.7.1 handler------39921.7.2 server------40021.7.3 Define a custom server------40121.7.4 Customizing the Application server------403

22nd Web application Programming------404

22.1 ftplib------40422.2 HTTP packet------40722.2.1 http.client (httplib)------40822.2.2 http.server (Basehttp-server, Cgihttpserver and Simplehttp Server)------41222.2.3 http.cookies (Cookies)------41622.2.4 http.cookiejar (cookielib)--- ---41822.3 smtplib------41822.4 urllib Pack------41922.4.1 urllib.request (URLLIB2)------41922.4.2 Urllib.response------42322.4.3 urllib.parse------42422.4.4 urllib.error------42622.4.5 Urllib.robotparser ( Robotparser)------42722.4.6 Note------42722.5 xmlrpc pack------42722.5.1 xmlrpc.client (xmlrpclib)------42722.5.2 Xmlrpc.server (Simple-xmlrpcserver and Docxmlr-pcserver)------430

The 23rd Chapter: Web Programming------433

23.1 CGI------43523.1.1 CGI Programming advice------43823.1.2 NOTE------43923.2 CGITB------44023.3wsgiref------44023.3.1 WSGI specification------44023.3.2 NOTE------44223.4 webbrowser------444

24th------445 of network data processing and encoding

24.1 base64------44524.2 binascii------44724.3 CSV------44724.3.1 dialect------44924.3.2 example------45024.4 Email Package------45024.4.1 Parsing e-mail------45024.4.2 Writing e-mail------45324.4.3 NOTE------45624.5 hashlib------45624.6 HMAC------45624.7 Htmlparser------45824.8 JSON------46024.9 mimetypes------46224.10 QUOPRI------46324.11 XML Package------46324.11.1 XML Sample document------46424.11.2 xm.dom.minidom------46524.11.3 xml.etree.ElementTree------46824.11.4 xml.sax------47424.11.5 Xml.sax.saxutils------476

25th Chapter: Other Library modules------477

25.1 Python Service------47725.2 string processing------47825.3 operating system modules------47825.4 network------47825.5 network data processing------47825.6 Internationalization------47825.7 Multi Media Services------47925.8 other------479

Part III: Extending and embedding------482

26th chapter: Extending and Embedding Python

26.1 Extension Module------48226.1.1 Extension Module prototype------48426.1.2 named extension------48626.1.3 Compilation and packaging extension------48626.1.4 from Python to C The type conversion of the language------48826.1.5 type conversions from C to Python------49226.1.6 add values to the module------49326.1.7 error handling------49426.1.8 reference count------49526.1.9 Thread------49626.2 Embedded python interpreter------49626.2.1 embedded template------49726.2.2 compile and link------49726.2.3 BASIC interpreter operations and settings------49726.2.4 in C Language to access python------49826.2.5 to convert Python objects to C objects------49926.3 ctypes------50026.3.1 load shared libraries------50026.3.2 The foreign function------the 50026.3.3 data type------50126.3.4 call the foreign function------50226.3.5 Other type construction methods------50326.3.6 Utility functions------50426.3.7 Example------50526.4 advanced extensions and embedding------50626.5 Jpython and IronPython------507

Appendix Python3------508

Directory of Python reference manuals

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.