📄 tut.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//CN"><html><head><link rel="STYLESHEET" href="style.css" type='text/css' /><link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /><link rel='start' href='../index.html' title='Python Documentation Index' /><link rel="first" href="tut.html" title='Python Tutorial' /><link rel='contents' href='node2.html' title="Contents" /><link rel='last' href='about.html' title='About this document...' /><link rel='help' href='about.html' title='About this document...' /><link rel="next" href="node1.html" /><meta name='aesop' content='information' /><title>Python Tutorial</title></head><body><DIV CLASS="navigation"><div id='top-navigation-panel' xml:id='top-navigation-panel'><table align="center" width="100%" cellpadding="0" cellspacing="2"><tr><td class='online-navigation'><img src='../icons/previous.png' border='0' height='32' alt='Previous Page' width='32' /></td><td class='online-navigation'><a rel="parent" title="Python Documentation Index" href="../index.html"><img src='../icons/up.png' border='0' height='32' alt='Up One Level' width='32' /></A></td><td class='online-navigation'><a rel="next" title="前言 Front Matter" href="node1.html"><img src='../icons/next.png' border='0' height='32' alt='Next Page' width='32' /></A></td><td align="center" width="100%" class='online-navigation'>Python Tutorial</td><td class='online-navigation'><a rel="contents" title="Table of Contents" href="node2.html"><img src='../icons/contents.png' border='0' height='32' alt='Contents' width='32' /></A></td><td class='online-navigation'><img src='../icons/blank.png' border='0' height='32' alt='' width='32' /></td><td class='online-navigation'><img src='../icons/blank.png' border='0' height='32' alt='' width='32' /></td></tr></table><div class='online-navigation'><b class="navlabel">Up:</b><a class="sectref" rel="parent" href="../index.html">Python Documentation Index</A><b class="navlabel">Next:</b><a class="sectref" rel="next" href="node1.html">前言 Front Matter</A></div><hr /></div></DIV><!--End of Navigation Panel--><P><link rel='up' href='../index.html' title='Python Documentation Index' /><div class="titlepage"><div class='center'><h1>Python Tutorial</h1><p></p></div></div><P><p><br /></p><hr class='online-navigation' /><div class='online-navigation'><!--Table of Child-Links--><A NAME="CHILD_LINKS"></a><UL CLASS="ChildLinks"><LI><A href="node1.html">前言 Front Matter</a><LI><A href="node2.html">Contents</a><LI><A href="node3.html">1. 开胃菜 Whetting Your Appetite</a><LI><A href="node4.html">2. 使用Python解释器 Using the Python Interpreter</a><UL><LI><A href="node4.html#SECTION004100000000000000000">2.1 调用解释器 Invoking the Interpreter</a><UL><LI><A href="node4.html#SECTION004110000000000000000">2.1.1 参数传递 Argument Passing</a><LI><A href="node4.html#SECTION004120000000000000000">2.1.2 交互模式 Interactive Mode</a></ul><LI><A href="node4.html#SECTION004200000000000000000">2.2 解释器及其环境 The Interpreter and Its Environment</a><UL><LI><A href="node4.html#SECTION004210000000000000000">2.2.1 错误处理 Error Handling</a><LI><A href="node4.html#SECTION004220000000000000000">2.2.2 执行Python脚本 Executable Python Scripts</a><LI><A href="node4.html#SECTION004230000000000000000">2.2.3 源程序编码 Source Code Encoding</a><LI><A href="node4.html#SECTION004240000000000000000">2.2.4 交互式环境的启动文件 The Interactive Startup File</a></ul></ul><LI><A href="node5.html">3. Python简介 An Informal Introduction to Python</a><UL><LI><A href="node5.html#SECTION005100000000000000000">3.1 将Python当作计算器使用 Using Python as a Calculator</a><UL><LI><A href="node5.html#SECTION005110000000000000000">3.1.1 数值 Numbers</a><LI><A href="node5.html#SECTION005120000000000000000">3.1.2 字符串 Strings</a><LI><A href="node5.html#SECTION005130000000000000000">3.1.3 Unicode 字符串 Unicode Strings</a><LI><A href="node5.html#SECTION005140000000000000000">3.1.4 链表 Lists</a></ul><LI><A href="node5.html#SECTION005200000000000000000">3.2 开始编程 First Steps Towards Programming</a></ul><LI><A href="node6.html">4. 深入流程控制 More Control Flow Tools</a><UL><LI><A href="node6.html#SECTION006100000000000000000">4.1 <tt class="keyword">if</tt> 语句 <tt class="keyword">if</tt> Statements</a><LI><A href="node6.html#SECTION006200000000000000000">4.2 <tt class="keyword">for</tt> 语句 <tt class="keyword">for</tt> Statements</a><LI><A href="node6.html#SECTION006300000000000000000">4.3 <tt class="function">range()</tt> 函数 The <tt class="function">range()</tt> Function</a><LI><A href="node6.html#SECTION006400000000000000000">4.4 <tt class="keyword">break</tt> 和 <tt class="keyword">continue</tt> 语句, 以及
循环中的 <tt class="keyword">else</tt> 子句
<tt class="keyword">break</tt> and <tt class="keyword">continue</tt> Statements, and
<tt class="keyword">else</tt> Clauses on Loops</a><LI><A href="node6.html#SECTION006500000000000000000">4.5 <tt class="keyword">pass</tt> 语句 <tt class="keyword">pass</tt> Statements</a><LI><A href="node6.html#SECTION006600000000000000000">4.6 Defining Functions</a><LI><A href="node6.html#SECTION006700000000000000000">4.7 深入函数定义 More on Defining Functions</a><UL><LI><A href="node6.html#SECTION006710000000000000000">4.7.1 参数默认值 Default Argument Values</a><LI><A href="node6.html#SECTION006720000000000000000">4.7.2 关键字参数 Keyword Arguments</a><LI><A href="node6.html#SECTION006730000000000000000">4.7.3 可变参数表 Arbitrary Argument Lists</a><LI><A href="node6.html#SECTION006740000000000000000">4.7.4 参数列表的分拆 Unpacking Argument Lists</a><LI><A href="node6.html#SECTION006750000000000000000">4.7.5 Lambda 形式 Lambda Forms</a><LI><A href="node6.html#SECTION006760000000000000000">4.7.6 文档字符串 Documentation Strings</a></ul></ul><LI><A href="node7.html">5. 数据结构 Data Structures</a><UL><LI><A href="node7.html#SECTION007100000000000000000">5.1 深入链表 More on Lists</a><UL><LI><A href="node7.html#SECTION007110000000000000000">5.1.1 把链表当作堆栈使用 Using Lists as Stacks</a><LI><A href="node7.html#SECTION007120000000000000000">5.1.2 把链表当作队列使用 Using Lists as Queues</a><LI><A href="node7.html#SECTION007130000000000000000">5.1.3 函数化编程工具 Functional Programming Tools</a><LI><A href="node7.html#SECTION007140000000000000000">5.1.4 链表推导式 List Comprehensions</a></ul><LI><A href="node7.html#SECTION007200000000000000000">5.2 <tt class="keyword">del</tt> 语句</a><LI><A href="node7.html#SECTION007300000000000000000">5.3 元组(Tuples)和序列(Sequences )Tuples and Sequences</a><LI><A href="node7.html#SECTION007400000000000000000">5.4 Dictionaries 字典</a><LI><A href="node7.html#SECTION007500000000000000000">5.5 循环技巧 Looping Techniques</a><LI><A href="node7.html#SECTION007600000000000000000">5.6 深入条件控制 More on Conditions</a><LI><A href="node7.html#SECTION007700000000000000000">5.7 比较序列和其它类型 Comparing Sequences and Other Types</a></ul><LI><A href="node8.html">6. 模块 Modules</a><UL><LI><A href="node8.html#SECTION008100000000000000000">6.1 深入模块 More on Modules</a><UL><LI><A href="node8.html#SECTION008110000000000000000">6.1.1 模块搜索路径 The Module Search Path</a><LI><A href="node8.html#SECTION008120000000000000000">6.1.2 “编译”Python文件 ``Compiled'' Python files</a></ul><LI><A href="node8.html#SECTION008200000000000000000">6.2 标准模块 Standard Modules</a><LI><A href="node8.html#SECTION008300000000000000000">6.3 <tt class="function">dir()</tt> 函数 <tt class="function">dir()</tt> Function</a><LI><A href="node8.html#SECTION008400000000000000000">6.4 包 Packages</a><UL><LI><A href="node8.html#SECTION008410000000000000000">6.4.1 以 * 方式加载包 Importing * From a Package</a><LI><A href="node8.html#SECTION008420000000000000000">6.4.2 内置包(Intra-package)参考 Intra-package References</a><LI><A href="node8.html#SECTION008430000000000000000">6.4.3 多重路径中的包 Packages in Multiple Directories</a></ul></ul><LI><A href="node9.html">7. 输入和输出 Input and Output</a><UL><LI><A href="node9.html#SECTION009100000000000000000">7.1 设计输出格式 Fancier Output Formatting</a><LI><A href="node9.html#SECTION009200000000000000000">7.2 读写文件 Reading and Writing Files</a><UL><LI><A href="node9.html#SECTION009210000000000000000">7.2.1 文件对象(file object)的方法 Methods of File Objects</a><LI><A href="node9.html#SECTION009220000000000000000">7.2.2 <tt class="module">pickle</tt> 模块 <tt class="module">pickle</tt> Module</a></ul></ul><LI><A href="node10.html">8. 错误和异常 Errors and Exceptions</a><UL><LI><A href="node10.html#SECTION0010100000000000000000">8.1 异常 Exceptions</a><LI><A href="node10.html#SECTION0010200000000000000000">8.2 处理异常 Handling Exceptions</a><LI><A href="node10.html#SECTION0010300000000000000000">8.3 抛出异常 Raising Exceptions</a><LI><A href="node10.html#SECTION0010400000000000000000">8.4 用户自定义异常 User-defined Exceptions</a><LI><A href="node10.html#SECTION0010500000000000000000">8.5 定义清理行为 Defining Clean-up Actions</a></ul><LI><A href="node11.html">9. 类 Classes</a><UL><LI><A href="node11.html#SECTION0011100000000000000000">9.1 有关术语的话题 A Word About Terminology</a><LI><A href="node11.html#SECTION0011200000000000000000">9.2 Python 作用域和命名空间 Python Scopes and Name Spaces</a><LI><A href="node11.html#SECTION0011300000000000000000">9.3 初识类 A First Look at Classes</a><UL><LI><A href="node11.html#SECTION0011310000000000000000">9.3.1 类定义语法 Class Definition Syntax</a><LI><A href="node11.html#SECTION0011320000000000000000">9.3.2 类对象 Class Objects</a><LI><A href="node11.html#SECTION0011330000000000000000">9.3.3 实例对象 Instance Objects</a><LI><A href="node11.html#SECTION0011340000000000000000">9.3.4 方法对象 Method Objects</a></ul><LI><A href="node11.html#SECTION0011400000000000000000">9.4 一些说明 Random Remarks</a><LI><A href="node11.html#SECTION0011500000000000000000">9.5 继承 Inheritance</a><UL><LI><A href="node11.html#SECTION0011510000000000000000">9.5.1 多继承 Multiple Inheritance</a></ul><LI><A href="node11.html#SECTION0011600000000000000000">9.6 私有变量 Private Variables</a><LI><A href="node11.html#SECTION0011700000000000000000">9.7 补充 Odds and Ends</a><LI><A href="node11.html#SECTION0011800000000000000000">9.8 异常也是类 Exceptions Are Classes Too</a><LI><A href="node11.html#SECTION0011900000000000000000">9.9 迭代器 Iterators</a><LI><A href="node11.html#SECTION00111000000000000000000">9.10 生成器 Generators</a></ul><LI><A href="node12.html">10. 标准库概览 Brief Tour of the Standard Library</a><UL><LI><A href="node12.html#SECTION0012100000000000000000">10.1 操作系统概览 Operating System Interface</a><LI><A href="node12.html#SECTION0012200000000000000000">10.2 文件通配符 File Wildcards</a><LI><A href="node12.html#SECTION0012300000000000000000">10.3 命令行参数 Command Line Arguments</a><LI><A href="node12.html#SECTION0012400000000000000000">10.4 错误输出重定向和程序终止 Error Output Redirection and Program Termination</a><LI><A href="node12.html#SECTION0012500000000000000000">10.5 字符串正则匹配 String Pattern Matching</a><LI><A href="node12.html#SECTION0012600000000000000000">10.6 数学 Mathematics</a><LI><A href="node12.html#SECTION0012700000000000000000">10.7 互联网访问 Internet Access</a><LI><A href="node12.html#SECTION0012800000000000000000">10.8 日期和时间 Dates and Times</a><LI><A href="node12.html#SECTION0012900000000000000000">10.9 数据压缩 Data Compression</a><LI><A href="node12.html#SECTION00121000000000000000000">10.10 性能度量 Performance Measurement</a><LI><A href="node12.html#SECTION00121100000000000000000">10.11 质量控制 Quality Control</a><LI><A href="node12.html#SECTION00121200000000000000000">10.12 Batteries Included</a></ul><LI><A href="node13.html">11. What Now?</a><LI><A href="node14.html">A. Interactive Input Editing and History Substitution</a><UL><LI><A href="node14.html#SECTION0014100000000000000000">A.1 Line Editing</a><LI><A href="node14.html#SECTION0014200000000000000000">A.2 History Substitution</a><LI><A href="node14.html#SECTION0014300000000000000000">A.3 Key Bindings</a><LI><A href="node14.html#SECTION0014400000000000000000">A.4 Commentary</a></ul><LI><A href="node15.html">B. Floating Point Arithmetic: Issues and Limitations</a><UL><LI><A href="node15.html#SECTION0015100000000000000000">B.1 Representation Error</a></ul><LI><A href="node16.html">C. History and License</a><LI><A href="node17.html">D. Glossary</a><LI><A href="node18.html">About this document ...</a></ul><!--End of Table of Child-Links--></div><DIV CLASS="navigation"><div class='online-navigation'><p></p><hr /><table align="center" width="100%" cellpadding="0" cellspacing="2"><tr><td class='online-navigation'><img src='../icons/previous.png' border='0' height='32' alt='Previous Page' width='32' /></td><td class='online-navigation'><a rel="parent" title="Python Documentation Index" href="../index.html"><img src='../icons/up.png' border='0' height='32' alt='Up One Level' width='32' /></A></td><td class='online-navigation'><a rel="next" title="前言 Front Matter" href="node1.html"><img src='../icons/next.png' border='0' height='32' alt='Next Page' width='32' /></A></td><td align="center" width="100%" class='online-navigation'>Python Tutorial</td><td class='online-navigation'><a rel="contents" title="Table of Contents" href="node2.html"><img src='../icons/contents.png' border='0' height='32' alt='Contents' width='32' /></A></td><td class='online-navigation'><img src='../icons/blank.png' border='0' height='32' alt='' width='32' /></td><td class='online-navigation'><img src='../icons/blank.png' border='0' height='32' alt='' width='32' /></td></tr></table><div class='online-navigation'><b class="navlabel">Up:</b><a class="sectref" rel="parent" href="../index.html">Python Documentation Index</A><b class="navlabel">Next:</b><a class="sectref" rel="next" href="node1.html">前言 Front Matter</A></div></div><hr /></DIV><!--End of Navigation Panel--><ADDRESS>译者:刘鑫(march.liu AT gmail DOT com) 由:limodou转(limodou AT gmail DOT com)<br>See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -