Python Tutorial 入门指南3.6英文版

时间:2021-06-25 09:26:47
【文件属性】:

文件名称:Python Tutorial 入门指南3.6英文版

文件大小:1.67MB

文件格式:PDF

更新时间:2021-06-25 09:26:47

Python Tutorial 入门指南 3.6 英文版

Index The Python Tutorial 1 1. Whetting Your Appetite 4 2. Using the Python Interpreter 6 2.1. Invoking the Interpreter 7 2.1.1. Argument Passing 8 2.1.2. Interactive Mode 8 2.2. The Interpreter and Its Environment 9 2.2.1. Source Code Encoding 9 3. An Informal Introduction to Python 10 3.1. Using Python as a Calculator 11 3.1.1. Numbers 11 3.1.2. Strings 13 3.1.3. Lists 19 3.2. First Steps Towards Programming 21 4. More Control Flow Tools 24 4.1. if Statements 24 4.2. for Statements 24 4.3. The range() Function 25 4.4. break and continue Statements, and else Clauses on Loops 27 4.5. pass Statements 28 4.6. Defining Functions 29 4.7. More on Defining Functions 31 4.7.1. Default Argument Values 31 4.7.2. Keyword Arguments 33 4.7.3. Arbitrary Argument Lists 35 4.7.4. Unpacking Argument Lists 36 4.7.5. Lambda Expressions 37 4.7.6. Documentation Strings 38 4.7.7. Function Annotations 39 4.8. Intermezzo: Coding Style 39 5. Data Structures 40 5.1. More on Lists 41 5.1.1. Using Lists as Stacks 43 5.1.2. Using Lists as Queues 43 5.1.3. List Comprehensions 44 5.1.4. Nested List Comprehensions 46 5.2. The del statement 47 5.3. Tuples and Sequences 48 5.4. Sets 50 5.5. Dictionaries 51 5.6. Looping Techniques 53 5.7. More on Conditions 55 5.8. Comparing Sequences and Other Types 56 6. Modules 57 6.1. More on Modules 58 6.1.1. Executing modules as scripts 60 6.1.2. The Module Search Path 61 6.1.3. “Compiled” Python files 61 6.2. Standard Modules 62 6.3. The dir() Function 63 6.4. Packages 66 6.4.1. Importing * From a Package 68 6.4.2. Intra-package References 69 6.4.3. Packages in Multiple Directories 70 7. Input and Output 70 7.1. Fancier Output Formatting 70 7.1.1. Old string formatting 75 7.2. Reading and Writing Files 76 7.2.1. Methods of File Objects 77 7.2.2. Saving structured data with json 79 8. Errors and Exceptions 81 8.1. Syntax Errors 81 8.2. Exceptions 81 8.3. Handling Exceptions 82 8.4. Raising Exceptions 86 8.5. User-defined Exceptions 87 8.6. Defining Clean-up Actions 88 8.7. Predefined Clean-up Actions 89 9. Classes 90 9.1. A Word About Names and Objects 91 9.2. Python Scopes and Namespaces 91 9.2.1. Scopes and Namespaces Example 94 9.3. A First Look at Classes 95 9.3.1. Class Definition Syntax 95 9.3.2. Class Objects 96 9.3.3. Instance Objects 97 9.3.4. Method Objects 98 9.3.5. Class and Instance Variables 99 9.4. Random Remarks 100 9.5. Inheritance 102 9.5.1. Multiple Inheritance 104 9.6. Private Variables 105 9.7. Odds and Ends 106 9.8. Iterators 106 9.9. Generators 108 9.10. Generator Expressions 109 10. Brief Tour of the Standard Library 110 10.1. Operating System Interface 110 10.2. File Wildcards 111 10.3. Command Line Arguments 111 10.4. Error Output Redirection and Program Termination 112 10.5. String Pattern Matching 112 10.6. Mathematics 113 10.7. Internet Access 114 10.8. Dates and Times 114 10.9. Data Compression 115 10.10. Performance Measurement 115 10.11. Quality Control 116 10.12. Batteries Included 117 11. Brief Tour of the Standard Library — Part II 117 11.1. Output Formatting 118 11.2. Templating 119 11.3. Working with Binary Data Record Layouts 121 11.4. Multi-threading 121 11.5. Logging 122 11.6. Weak References 123 11.7. Tools for Working with Lists 124 11.8. Decimal Floating Point Arithmetic 126 12. Virtual Environments and Packages 127 12.1. Introduction 127 12.2. Creating Virtual Environments 128 12.3. Managing Packages with pip 129 13. What Now? 131 14. Interactive Input Editing and History Substitution 133 14.1. Tab Completion and History Editing 133 14.2. Alternatives to the Interactive Interpreter 133 15. Floating Point Arithmetic: Issues and Limitations 134 15.1. Representation Error 139 16. Appendix 141 16.1. Interactive Mode 141 16.1.1. Error Handling 141 16.1.2. Executable Python Scripts 142 16.1.3. The Interactive Startup File 142 16.1.4. The Customization Modules 143


网友评论