This file is indexed.

/usr/share/doc/diveintopython-zh/html/getting_to_know_python/index.html is in diveintopython-zh 5.4b-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
      <title>&nbsp;2&nbsp;&nbsp;第一个 Python 程序</title>
      <link rel="stylesheet" href="../diveintopython.css" type="text/css">
      <link rev="made" href="mailto:f8dy@diveintopython.org">
      <meta name="generator" content="DocBook XSL Stylesheets V1.52.2">
      <meta name="keywords" content="Python, Dive Into Python, tutorial, object-oriented, programming, documentation, book, free">
      <meta name="description" content="Python from novice to pro">
      <link rel="home" href="../toc/index.html" title="Dive Into Python">
      <link rel="up" href="../toc/index.html" title="Dive Into Python">
      <link rel="previous" href="../installing_python/summary.html" title="1.9.&nbsp;小结">
      <link rel="next" href="declaring_functions.html" title="2.2.&nbsp;函数声明">
   </head>
   <body>
      <table id="Header" width="100%" border="0" cellpadding="0" cellspacing="0" summary="">
         <tr>
            <td id="breadcrumb" colspan="5" align="left" valign="top">导航:<a href="../index.html">起始页</a>&nbsp;&gt;&nbsp;<a href="../toc/index.html">Dive Into Python</a>&nbsp;&gt;&nbsp;<span class="thispage">第一个 Python 程序</span></td>
            <td id="navigation" align="right" valign="top">&nbsp;&nbsp;&nbsp;<a href="../installing_python/summary.html" title="上一页: “小结”">&lt;&lt;</a>&nbsp;&nbsp;&nbsp;<a href="declaring_functions.html" title="下一页: “函数声明”">&gt;&gt;</a></td>
         </tr>
         <tr>
            <td colspan="3" id="logocontainer">
               <h1 id="logo"><a href="../index.html" accesskey="1">深入 Python :Dive Into Python 中文版</a></h1>
               <p id="tagline">Python 从新手到专家 [Dip_5.4b_CPyUG_Release]</p>
            </td>
            <td colspan="3" align="right">
               <form id="search" method="GET" action="http://www.google.com/custom">
                  <p><label for="q" accesskey="4">Find:&nbsp;</label><input type="text" id="q" name="q" size="20" maxlength="255" value=""> <input type="submit" value="搜索"><input type="hidden" name="domains" value="woodpecker.org.cn"><input type="hidden" name="sitesearch" value="www.woodpecker.org.cn/diveintopython"></p>
               </form>
            </td>
         </tr>
      </table>
      <!--#include virtual="/inc/ads" -->
      <div class="chapter" lang="zh_cn">
         <div class="titlepage">
            <div>
               <div>
                  <h2 class="title"><a name="odbchelper"></a>&nbsp;2&nbsp;&nbsp;第一个 <span class="application">Python</span> 程序
                  </h2>
               </div>
            </div>
            <div></div>
         </div>
         <div class="toc">
            <ul>
               <li><span class="section"><a href="index.html#odbchelper.divein">2.1. 概览</a></span></li>
               <li><span class="section"><a href="declaring_functions.html">2.2. 函数声明</a></span><ul>
                     <li><span class="section"><a href="declaring_functions.html#d0e4309">2.2.1. Python 和其他编程语言数据类型的比较</a></span></li>
                  </ul>
               </li>
               <li><span class="section"><a href="documenting_functions.html">2.3. 文档化函数</a></span></li>
               <li><span class="section"><a href="everything_is_an_object.html">2.4. 万物皆对象</a></span><ul>
                     <li><span class="section"><a href="everything_is_an_object.html#d0e4671">2.4.1. 模块导入的搜索路径</a></span></li>
                     <li><span class="section"><a href="everything_is_an_object.html#d0e4786">2.4.2. 何谓对象?</a></span></li>
                  </ul>
               </li>
               <li><span class="section"><a href="indenting_code.html">2.5. 代码缩进</a></span></li>
               <li><span class="section"><a href="testing_modules.html">2.6. 测试模块</a></span></li>
            </ul>
         </div>
         <div class="abstract">
            <p>大家都很清楚,其他书籍是如何一步步从编程基础讲述到构建完整的可运行程序的,但还是让我们跳过这个部分吧!
               
            </p>
         </div>
         <div class="section" lang="zh_cn">
            <div class="titlepage">
               <div>
                  <div>
                     <h2 class="title"><a name="odbchelper.divein"></a>2.1.&nbsp;概览
                     </h2>
                  </div>
               </div>
               <div></div>
            </div>
            <div class="abstract">
               <p>这是一个完整的、可执行的 <span class="application">Python</span> 程序。
               </p>
            </div>
            <p>它可能对您来说根本无法理解。别着急,我们将逐行地进行剖析。不过首先把代码通读一遍,看一看是否有些可以理解的内容。</p>
            <div class="example"><a name="d0e4069"></a><h3 class="title">&nbsp;2.1.&nbsp;<tt class="filename">odbchelper.py</tt></h3>
               <p>如果您还没有下载本书附带的样例程序, 可以 <a href="http://www.woodpecker.org.cn/diveintopython/download/diveintopython-exampleszh-cn-5.4b.zip" title="Download example scripts">下载本程序和其他样例程序</a></p><pre class="programlisting"><span class='pykeyword'>
def</span> buildConnectionString(params):
    <span class='pystring'>"""Build a connection string from a dictionary of parameters.

    Returns string."""</span>
    <span class='pykeyword'>return</span> <span class='pystring'>";"</span>.join([<span class='pystring'>"%s=%s"</span> % (k, v) <span class='pykeyword'>for</span> k, v <span class='pykeyword'>in</span> params.items()])

<span class='pykeyword'>if</span> __name__ == <span class='pystring'>"__main__"</span>:
    myParams = {<span class='pystring'>"server"</span>:<span class='pystring'>"mpilgrim"</span>, \
                <span class='pystring'>"database"</span>:<span class='pystring'>"master"</span>, \
                <span class='pystring'>"uid"</span>:<span class='pystring'>"sa"</span>, \
                <span class='pystring'>"pwd"</span>:<span class='pystring'>"secret"</span> \
                }
    <span class='pykeyword'>print</span> buildConnectionString(myParams)</pre></div>
            <p>现在运行一下这个程序,看一看结果是什么。</p><a name="tip.run.windows"></a><table class="tip" border="0" summary="">
               <tr>
                  <td rowspan="2" align="center" valign="top" width="1%"><img src="../images/tip.png" alt="提示" title="" width="24" height="24"></td>
               </tr>
               <tr>
                  <td colspan="2" align="left" valign="top" width="99%">在 Windows 的 <span class="application">ActivePython</span> <span class="acronym">IDE</span> 中,可以选择
                     <span class="guimenu">File</span>-&gt;<span class="guimenuitem"><span class="accel">R</span>un...</span> (<span><b class="shortcut"><span><b class="keycap">Ctrl</b></span>-<span class="keysym">R</span></b></span>) 来运行 <span class="application">Python</span> 程序。输出结果将显示在交互窗口中。
                  </td>
               </tr>
            </table><a name="tip.run.mac"></a><table class="tip" border="0" summary="">
               <tr>
                  <td rowspan="2" align="center" valign="top" width="1%"><img src="../images/tip.png" alt="提示" title="" width="24" height="24"></td>
               </tr>
               <tr>
                  <td colspan="2" align="left" valign="top" width="99%"><span class="abbrev">Mac</span> <span class="acronym">OS</span><span class="application">Python</span> <span class="acronym">IDE</span> 中,可以选择
                     <span class="guimenu">Python</span>-&gt;<span class="guimenuitem">Run window...</span> (<span><b class="shortcut"><span><b class="keycap">Cmd</b></span>-<span class="keysym">R</span></b></span>) 来运行 <span class="application">Python</span> 程序,但首先要设置一个重要的选项。在 <span class="acronym">IDE</span> 中打开 <tt class="filename">.py</tt> 模块,点击窗口右上角的黑色三角,弹出这个模块的选项菜单,然后将 <span class="guimenuitem">Run as __main__</span> 选中。 这个设置是同模块一同保存的,所以对于每个模块您都需要这样做。
                  </td>
               </tr>
            </table><a name="tip.run.unix"></a><table class="tip" border="0" summary="">
               <tr>
                  <td rowspan="2" align="center" valign="top" width="1%"><img src="../images/tip.png" alt="提示" title="" width="24" height="24"></td>
               </tr>
               <tr>
                  <td colspan="2" align="left" valign="top" width="99%"><span class="acronym">UNIX</span> 兼容的操作系统中 (包括 <span class="abbrev">Mac</span> <span class="acronym">OS</span> X),可以通过命令行:<b class="userinput"><tt>python <tt class="filename">odbchelper.py</tt></tt></b> 运行模块。
                     
                  </td>
               </tr>
            </table>
            <div class="informalexample"><a name="odbchelper.output"></a><p><tt class="filename">odbchelper.py</tt> 的输出结果:
               </p><pre class="screen"><span class="computeroutput">server=mpilgrim;uid=sa;database=master;pwd=secret</span></pre></div>
         </div>
      </div>
      <table class="Footer" width="100%" border="0" cellpadding="0" cellspacing="0" summary="">
         <tr>
            <td width="35%" align="left"><br><a class="NavigationArrow" href="../installing_python/summary.html">&lt;&lt;&nbsp;小结</a></td>
            <td width="30%" align="center"><br>&nbsp;<span class="divider">|</span>&nbsp;<span class="thispage">1</span> <span class="divider">|</span> <a href="declaring_functions.html" title="2.2.&nbsp;函数声明">2</a> <span class="divider">|</span> <a href="documenting_functions.html" title="2.3.&nbsp;文档化函数">3</a> <span class="divider">|</span> <a href="everything_is_an_object.html" title="2.4.&nbsp;万物皆对象">4</a> <span class="divider">|</span> <a href="indenting_code.html" title="2.5.&nbsp;代码缩进">5</a> <span class="divider">|</span> <a href="testing_modules.html" title="2.6.&nbsp;测试模块">6</a>&nbsp;<span class="divider">|</span>&nbsp;
            </td>
            <td width="35%" align="right"><br><a class="NavigationArrow" href="declaring_functions.html">函数声明&nbsp;&gt;&gt;</a></td>
         </tr>
         <tr>
            <td colspan="3"><br></td>
         </tr>
      </table>
      <div class="Footer">
         <p class="copyright">Copyright © 2000, 2001, 2002, 2003, 2004 <a href="mailto:mark@diveintopython.org">Mark Pilgrim</a></p>
         <p class="copyright">Copyright © 2001, 2002, 2003, 2004, 2005, 2006, 2007 <a href="mailto:python-cn@googlegroups.com">CPyUG (邮件列表)</a></p>
      </div>
   </body>
</html>