PageRenderTime 68ms CodeModel.GetById 35ms RepoModel.GetById 0ms app.codeStats 0ms

/table-of-contents.html

https://bitbucket.org/dipyzh/dipyzh.bitbucket.org
HTML | 446 lines | 443 code | 2 blank | 1 comment | 0 complexity | 36de15495d699d34229c8257fae7e695 MD5 | raw file
  1. <!DOCTYPE html>
  2. <meta charset=utf-8>
  3. <title>目录 - 深入 Python 3</title>
  4. <link rel=stylesheet href=dip3.css>
  5. <style>
  6. h1:before{content:''}
  7. ol,ul{font-weight:bold}
  8. li ol{font-weight:normal}
  9. #porting-code-to-python-3-with-2to3,#special-method-names,#where-to-go-from-here{list-style:none;margin:0 0 0 -2em}
  10. #porting-code-to-python-3-with-2to3 > ol,#special-method-names > ol,#where-to-go-from-here > ol{margin:0;padding:0 0 0 4.5em}
  11. #porting-code-to-python-3-with-2to3:before{content:'A. \00a0 \00a0'}
  12. #special-method-names:before{content:'B. \00a0 \00a0'}
  13. #where-to-go-from-here:before{content:'C. \00a0 \00a0'}
  14. </style>
  15. <link rel=stylesheet media='only screen and (max-device-width: 480px)' href=mobile.css>
  16. <link rel=stylesheet media=print href=print.css>
  17. <meta name=viewport content='initial-scale=1.0'>
  18. <form action=http://www.google.com/cse><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8><input type=search name=q size=25 placeholder="powered by Google&trade;">&nbsp;<input type=submit name=sa value=搜索></div></form>
  19. <p>当前位置 <a href=index.html>首页</a> <span class=u></span> 深入 Python 3 <span class=u></span>
  20. <h1>目录</h1><!-- toc -->
  21. <ol start=-1>
  22. <li id=whats-new><a href=whats-new.html>深入 Python 3中有何新内容</a>
  23. <ol>
  24. <li><a href=whats-new.html#divingin><i>又名</i> 负号层</a>
  25. </li></ol>
  26. </li><li id=installing-python><a href=installing-python.html>安装 Python</a>
  27. <ol>
  28. <li><a href=installing-python.html#divingin>深入</a>
  29. </li><li><a href=installing-python.html#which>哪个版本的 Python 适合您</a>
  30. </li><li><a href=installing-python.html#windows> Microsoft Windows 上安装</a>
  31. </li><li><a href=installing-python.html#macosx> Mac OS X 上安装</a>
  32. </li><li><a href=installing-python.html#ubuntu> Ubuntu Linux 上安装</a>
  33. </li><li><a href=installing-python.html#other>在其它平台上安装</a>
  34. </li><li><a href=installing-python.html#idle>使用 Python Shell</a>
  35. </li><li><a href=installing-python.html#editors>Python 编辑器和集成开发环境</a>
  36. </li></ol>
  37. </li><li id=your-first-python-program><a href=your-first-python-program.html>第一份 Python 程序</a>
  38. <ol>
  39. <li><a href=your-first-python-program.html#divingin>深入</a>
  40. </li><li><a href=your-first-python-program.html#declaringfunctions>函数声明</a>
  41. <ol>
  42. <li><a href=your-first-python-program.html#optional-arguments>可选参数和命名参数</a>
  43. </li></ol>
  44. </li><li><a href=your-first-python-program.html#readability>撰写可读代码</a>
  45. <ol>
  46. <li><a href=your-first-python-program.html#docstrings>文档字符串</a>
  47. </li></ol>
  48. </li><li><a href=your-first-python-program.html#importsearchpath><code>import</code> 搜索路径</a>
  49. </li><li><a href=your-first-python-program.html#everythingisanobject>一切都是对象</a>
  50. <ol>
  51. <li><a href=your-first-python-program.html#whatsanobject>什么是对象</a>
  52. </li></ol>
  53. </li><li><a href=your-first-python-program.html#indentingcode>代码缩进</a>
  54. </li><li><a href=your-first-python-program.html#exceptions>例外</a>
  55. <ol>
  56. <li><a href=your-first-python-program.html#importerror>捕捉 Import 错误</a>
  57. </li></ol>
  58. </li><li><a href=your-first-python-program.html#nameerror>未绑定变量</a>
  59. </li><li><a href=your-first-python-program.html#case>一切都区分大小写</a>
  60. </li><li><a href=your-first-python-program.html#runningscripts>运行脚本</a>
  61. </li><li><a href=your-first-python-program.html#furtherreading>深入阅读</a>
  62. </li></ol>
  63. </li><li id=native-datatypes><a href=native-datatypes.html>内置数据类型</a>
  64. <ol>
  65. <li><a href=native-datatypes.html#divingin>深入</a>
  66. </li><li><a href=native-datatypes.html#booleans>布尔类型</a>
  67. </li><li><a href=native-datatypes.html#numbers>数值类型</a>
  68. <ol>
  69. <li><a href=native-datatypes.html#number-coercion>将整数强制转换为浮点数及反向转换</a>
  70. </li><li><a href=native-datatypes.html#common-numerical-operations>常用数值运算</a>
  71. </li><li><a href=native-datatypes.html#fractions>分数</a>
  72. </li><li><a href=native-datatypes.html#trig>三角函数</a>
  73. </li><li><a href=native-datatypes.html#numbers-in-a-boolean-context>布尔上下文环境中的数值</a>
  74. </li></ol>
  75. </li><li><a href=native-datatypes.html#lists>列表</a>
  76. <ol>
  77. <li><a href=native-datatypes.html#creatinglists>创建列表</a>
  78. </li><li><a href=native-datatypes.html#slicinglists>列表切片</a>
  79. </li><li><a href=native-datatypes.html#extendinglists>向列表中新增项</a>
  80. </li><li><a href=native-datatypes.html#searchinglists>在列表中检索值</a>
  81. </li><li><a href=native-datatypes.html#removingfromlists>从列表中删除元素</a>
  82. </li><li><a href=native-datatypes.html#popgoestheweasel>Removing Items From A List: Bonus Round</a>
  83. </li><li><a href=native-datatypes.html#lists-in-a-boolean-context>布尔上下文环境中的列表</a>
  84. </li></ol>
  85. </li><li><a href=native-datatypes.html#tuples>元组</a>
  86. <ol>
  87. <li><a href=native-datatypes.html#tuples-in-a-boolean-context>布尔上下文环境中的元组</a>
  88. </li><li><a href=native-datatypes.html#multivar>同时赋多个值</a>
  89. </li></ol>
  90. </li><li><a href=native-datatypes.html#sets>集合</a>
  91. <ol>
  92. <li><a href=native-datatypes.html#creating-a-set>创建集合</a>
  93. </li><li><a href=native-datatypes.html#modifying-sets>修改集合</a>
  94. </li><li><a href=native-datatypes.html#removing-from-sets>从集合中删除元素</a>
  95. </li><li><a href=native-datatypes.html#common-set-operations>常见集合操作</a>
  96. </li><li><a href=native-datatypes.html#sets-in-a-boolean-context>布尔上下文环境中的集合</a>
  97. </li></ol>
  98. </li><li><a href=native-datatypes.html#dictionaries>字典</a>
  99. <ol>
  100. <li><a href=native-datatypes.html#creating-dictionaries>创建字典</a>
  101. </li><li><a href=native-datatypes.html#modifying-dictionaries>修改字典</a>
  102. </li><li><a href=native-datatypes.html#mixed-value-dictionaries>混合值字典</a>
  103. </li><li><a href=native-datatypes.html#dictionaries-in-a-boolean-context>布尔上下文环境中的字典</a>
  104. </li></ol>
  105. </li><li><a href=native-datatypes.html#none><code>None</code></a>
  106. <ol>
  107. <li><a href=native-datatypes.html#none-in-a-boolean-context>布尔上下文环境中的 <code>None</code></a>
  108. </li></ol>
  109. </li><li><a href=native-datatypes.html#furtherreading>深入阅读</a>
  110. </li></ol>
  111. </li><li id=comprehensions><a href=comprehensions.html>理解</a>
  112. <ol>
  113. <li><a href=comprehensions.html#divingin>深入</a>
  114. </li><li><a href=comprehensions.html#os>处理文件和目录</a>
  115. <ol>
  116. <li><a href=comprehensions.html#getcwd>当前工作目录</a>
  117. </li><li><a href=comprehensions.html#ospath>处理文件名和目录名</a>
  118. </li><li><a href=comprehensions.html#glob>列出目录</a>
  119. </li><li><a href=comprehensions.html#osstat>获取文件元数据</a>
  120. </li><li><a href=comprehensions.html#abspath>构造绝对路径</a>
  121. </li></ol>
  122. </li><li><a href=comprehensions.html#listcomprehension>列表解析</a>
  123. </li><li><a href=comprehensions.html#dictionarycomprehension>字典解析</a>
  124. <ol>
  125. <li><a href=comprehensions.html#stupiddicttricks>字典解析的其它趣事</a>
  126. </li></ol>
  127. </li><li><a href=comprehensions.html#setcomprehension>集合解析</a>
  128. </li><li><a href=comprehensions.html#furtherreading>深入阅读</a>
  129. </li></ol>
  130. </li><li id=strings><a href=strings.html>字符串</a>
  131. <ol>
  132. <li><a href=strings.html#boring-stuff>深入之前必须理解的繁琐内容</a>
  133. </li><li><a href=strings.html#one-ring-to-rule-them-all>Unicode</a>
  134. </li><li><a href=strings.html#divingin>深入</a>
  135. </li><li><a href=strings.html#formatting-strings>格式化字符串</a>
  136. <ol>
  137. <li><a href=strings.html#compound-field-names>符合字段名称</a>
  138. </li><li><a href=strings.html#format-specifiers>格式标识符</a>
  139. </li></ol>
  140. </li><li><a href=strings.html#common-string-methods>其它常见字符串方法</a>
  141. <ol>
  142. <li><a href=strings.html#slicingstrings>字符串切片</a>
  143. </li></ol>
  144. </li><li><a href=strings.html#byte-arrays>字符串与字节</a>
  145. </li><li><a href=strings.html#py-encoding>后记Python 源代码的字符编码</a>
  146. </li><li><a href=strings.html#furtherreading>深入阅读</a>
  147. </li></ol>
  148. </li><li id=regular-expressions><a href=regular-expressions.html>正则表达式</a>
  149. <ol>
  150. <li><a href=regular-expressions.html#divingin>深入</a>
  151. </li><li><a href=regular-expressions.html#streetaddresses>案例研究街道地址</a>
  152. </li><li><a href=regular-expressions.html#romannumerals>案例研究罗马数字</a>
  153. <ol>
  154. <li><a href=regular-expressions.html#thousands>检查千位</a>
  155. </li><li><a href=regular-expressions.html#hundreds>检查百位</a>
  156. </li></ol>
  157. </li><li><a href=regular-expressions.html#nmsyntax>使用 <code>{n,m}</code> 语法</a>
  158. <ol>
  159. <li><a href=regular-expressions.html#tensandones>检查十位和个位</a>
  160. </li></ol>
  161. </li><li><a href=regular-expressions.html#verbosere>长正则表达式</a>
  162. </li><li><a href=regular-expressions.html#phonenumbers>案例研究电话号码分析</a>
  163. </li><li><a href=regular-expressions.html#summary>摘要</a>
  164. </li></ol>
  165. </li><li id=generators><a href=generators.html>闭合 <i class=baa></i> 生成器</a>
  166. <ol>
  167. <li><a href=generators.html#divingin>深入</a>
  168. </li><li><a href=generators.html#i-know>我知道让我们用正则表达式</a>
  169. </li><li><a href=generators.html#a-list-of-functions>函数列表</a>
  170. </li><li><a href=generators.html#a-list-of-patterns>匹配模式列表</a>
  171. </li><li><a href=generators.html#a-file-of-patterns>匹配模式文件</a>
  172. </li><li><a href=generators.html#generators>生成器</a>
  173. <ol>
  174. <li><a href=generators.html#a-fibonacci-generator>斐波那奇生成器</a>
  175. </li><li><a href=generators.html#a-plural-rule-generator>复数规则生成器</a>
  176. </li></ol>
  177. </li><li><a href=generators.html#furtherreading>深入阅读</a>
  178. </li></ol>
  179. </li><li id=iterators><a href=iterators.html> <i class=baa>&amp;</i> 迭代器</a>
  180. <ol>
  181. <li><a href=iterators.html#divingin>深入</a>
  182. </li><li><a href=iterators.html#defining-classes>类的定义</a>
  183. <ol>
  184. <li><a href=iterators.html#init-method><code>__init__()</code> 方法</a>
  185. </li></ol>
  186. </li><li><a href=iterators.html#instantiating-classes>类的实例化</a>
  187. </li><li><a href=iterators.html#instance-variables>实例变量</a>
  188. </li><li><a href=iterators.html#a-fibonacci-iterator>斐波那奇迭代器</a>
  189. </li><li><a href=iterators.html#a-plural-rule-iterator>多元规则迭代器</a>
  190. </li><li><a href=iterators.html#furtherreading>深入阅读</a>
  191. </li></ol>
  192. </li><li id=advanced-iterators><a href=advanced-iterators.html>高级迭代器</a>
  193. <ol>
  194. <li><a href=advanced-iterators.html#divingin>深入</a>
  195. </li><li><a href=advanced-iterators.html#re-findall>找到所有匹配模式</a>
  196. </li><li><a href=advanced-iterators.html#unique-items>在某序列中查找唯一项</a>
  197. </li><li><a href=advanced-iterators.html#assert>制作断言</a>
  198. </li><li><a href=advanced-iterators.html#generator-expressions>生成器表达式</a>
  199. </li><li><a href=advanced-iterators.html#permutations>计算置换 懒人的办法</a>
  200. </li><li><a href=advanced-iterators.html#more-itertools><code>itertools</code> 模块中其它有趣的东西</a>
  201. </li><li><a href=advanced-iterators.html#string-translate>一种新的字符串操作</a>
  202. </li><li><a href=advanced-iterators.html#eval>将任意字符串转换为 Python 表达式</a>
  203. </li><li><a href=advanced-iterators.html#alphametics-finale>综述</a>
  204. </li><li><a href=advanced-iterators.html#furtherreading>深入阅读</a>
  205. </li></ol>
  206. </li><li id=unit-testing><a href=unit-testing.html>单元测试</a>
  207. <ol>
  208. <li><a href=unit-testing.html#divingin>不要深入</a>
  209. </li><li><a href=unit-testing.html#romantest1>一个简单的问题</a>
  210. </li><li><a href=unit-testing.html#romantest2>Halt And Catch Fire</a>
  211. </li><li><a href=unit-testing.html#romantest3>More Halting, More Fire</a>
  212. </li><li><a href=unit-testing.html#romantest4>还有一件事情</a>
  213. </li><li><a href=unit-testing.html#romantest5>可喜的对称性</a>
  214. </li><li><a href=unit-testing.html#romantest6>更多错误输入</a>
  215. </li></ol>
  216. </li><li id=refactoring><a href=refactoring.html>重构</a>
  217. <ol>
  218. <li><a href=refactoring.html#divingin>深入</a>
  219. </li><li><a href=refactoring.html#changing-requirements>控制需求变化</a>
  220. </li><li><a href=refactoring.html#refactoring>重构</a>
  221. </li><li><a href=refactoring.html#summary>摘要</a>
  222. </li></ol>
  223. </li><li id=files><a href=files.html>文件</a>
  224. <ol>
  225. <li><a href=files.html#divingin>深入</a>
  226. </li><li><a href=files.html#reading>读取文本文件</a>
  227. <ol>
  228. <li><a href=files.html#encoding>Character Encoding Rears Its Ugly Head</a>
  229. </li><li><a href=files.html#file-objects>流对象</a>
  230. </li><li><a href=files.html#read>从文本文件读取数据</a>
  231. </li><li><a href=files.html#close>关闭文件</a>
  232. </li><li><a href=files.html#with>自动关闭文件</a>
  233. </li><li><a href=files.html#for>每次读取一行数据</a>
  234. </li></ol>
  235. </li><li><a href=files.html#writing>将数据写入文本文件</a>
  236. <ol>
  237. <li><a href=files.html#encoding-again>又见字符串编码</a>
  238. </li></ol>
  239. </li><li><a href=files.html#binary>二进制文件</a>
  240. </li><li><a href=files.html#file-like-objects>来自非文件源的流对象</a>
  241. <ol>
  242. <li><a href=files.html#gzip>处理压缩文件</a>
  243. </li></ol>
  244. </li><li><a href=files.html#stdio>标准输入输出和错误</a>
  245. <ol>
  246. <li><a href=files.html#redirect>重定性标准输出</a>
  247. </li></ol>
  248. </li><li><a href=files.html#furtherreading>深入阅读</a>
  249. </li></ol>
  250. </li><li id=xml><a href=xml.html>XML</a>
  251. <ol>
  252. <li><a href=xml.html#divingin>深入</a>
  253. </li><li><a href=xml.html#xml-intro>XML 五分钟速成班</a>
  254. </li><li><a href=xml.html#xml-structure>The Structure Of An Atom Feed</a>
  255. </li><li><a href=xml.html#xml-parse>解析 XML</a>
  256. <ol>
  257. <li><a href=xml.html#xml-elements>元素是列表</a>
  258. </li><li><a href=xml.html#xml-attributes>属性是字典</a>
  259. </li></ol>
  260. </li><li><a href=xml.html#xml-find> XML 内搜索节点</a>
  261. </li><li><a href=xml.html#xml-lxml>进一步了解 lxml</a>
  262. </li><li><a href=xml.html#xml-generate>生成 XML</a>
  263. </li><li><a href=xml.html#xml-custom-parser>解析残缺的 XML</a>
  264. </li><li><a href=xml.html#furtherreading>深入阅读</a>
  265. </li></ol>
  266. </li><li id=serializing><a href=serializing.html>Python 对象序列化</a>
  267. <ol>
  268. <li><a href=serializing.html#divingin>深入</a>
  269. <ol>
  270. <li><a href=serializing.html#administrivia>关于本章示例的简要注意事项</a>
  271. </li></ol>
  272. </li><li><a href=serializing.html#dump>将数据保存为 Pickle 文件</a>
  273. </li><li><a href=serializing.html#load> Pickle 文件中载入数据</a>
  274. </li><li><a href=serializing.html#dumps>无文件序列化</a>
  275. </li><li><a href=serializing.html#protocol-versions>Bytes Strings 再次抬头</a>
  276. </li><li><a href=serializing.html#debugging>调试 Pickle 文件</a>
  277. </li><li><a href=serializing.html#json> Python 对象序列化以供其它语言读取</a>
  278. </li><li><a href=serializing.html#json-dump>将数据保存为 <abbr>JSON</abbr> 文件</a>
  279. </li><li><a href=serializing.html#json-types> Python 数据类型映射为 <abbr>JSON</abbr></a>
  280. </li><li><a href=serializing.html#json-unknown-types> <abbr>JSON</abbr> 不支持的数据类型序列化</a>
  281. </li><li><a href=serializing.html#json-load> <abbr>JSON</abbr> 文件中载入数据</a>
  282. </li><li><a href=serializing.html#furtherreading>深入阅读</a>
  283. </li></ol>
  284. </li><li id=http-web-services><a href=http-web-services.html>HTTP Web 服务</a>
  285. <ol>
  286. <li><a href=http-web-services.html#divingin>深入</a>
  287. </li><li><a href=http-web-services.html#http-features>HTTP 特性</a>
  288. <ol>
  289. <li><a href=http-web-services.html#caching>缓存</a>
  290. </li><li><a href=http-web-services.html#last-modified>Last-Modified 检查</a>
  291. </li><li><a href=http-web-services.html#etags>ETag</a>
  292. </li><li><a href=http-web-services.html#compression>压缩</a>
  293. </li><li><a href=http-web-services.html#redirects>重定向</a>
  294. </li></ol>
  295. </li><li><a href=http-web-services.html#dont-try-this-at-home>如果绕过 HTTP 获取数据</a>
  296. </li><li><a href=http-web-services.html#whats-on-the-wire>线路上有什么</a>
  297. </li><li><a href=http-web-services.html#introducing-httplib2><code>httplib2</code> 介绍</a>
  298. <ol>
  299. <li><a href=http-web-services.html#why-bytes>轻微离题解释为什么 <code>httplib2</code> 返回 Bytes 而不是 Strings</a>
  300. </li><li><a href=http-web-services.html#httplib2-caching><code>httplib2</code> 如何处理缓存</a>
  301. </li><li><a href=http-web-services.html#httplib2-etags><code>httplib2</code> 如何处理 <code>Last-Modified</code> <code>ETag</code> 头部信息</a>
  302. </li><li><a href=http-web-services.html#httplib2-compression><code>http2lib</code> 如何处理压缩</a>
  303. </li><li><a href=http-web-services.html#httplib2-redirects><code>httplib2</code> 如何处理重定向</a>
  304. </li></ol>
  305. </li><li><a href=http-web-services.html#beyond-get>超越 HTTP GET</a>
  306. </li><li><a href=http-web-services.html#beyond-post>超越 HTTP POST</a>
  307. </li><li><a href=http-web-services.html#furtherreading>深入阅读</a>
  308. </li></ol>
  309. </li><li id=case-study-porting-chardet-to-python-3><a href=case-study-porting-chardet-to-python-3.html>案例研究 <code>chardet</code> 移植到 Python 3</a>
  310. <ol>
  311. <li><a href=case-study-porting-chardet-to-python-3.html#divingin>深入</a>
  312. </li><li><a href=case-study-porting-chardet-to-python-3.html#faq.what>何为字符编码自动检测</a>
  313. <ol>
  314. <li><a href=case-study-porting-chardet-to-python-3.html#faq.impossible>这难道不可能</a>
  315. </li><li><a href=case-study-porting-chardet-to-python-3.html#faq.who>存在这样的算法吗</a>
  316. </li></ol>
  317. </li><li><a href=case-study-porting-chardet-to-python-3.html#divingin2><code>chardet</code> 模块介绍</a>
  318. <ol>
  319. <li><a href=case-study-porting-chardet-to-python-3.html#how.bom>带有 <abbr>BOM</abbr> <abbr>UTF-n</abbr> </a>
  320. </li><li><a href=case-study-porting-chardet-to-python-3.html#how.esc>转义编码</a>
  321. </li><li><a href=case-study-porting-chardet-to-python-3.html#how.mb>多字节编码</a>
  322. </li><li><a href=case-study-porting-chardet-to-python-3.html#how.sb>单字节编码</a>
  323. </li><li><a href=case-study-porting-chardet-to-python-3.html#how.windows1252><code>windows-1252</code></a>
  324. </li></ol>
  325. </li><li><a href=case-study-porting-chardet-to-python-3.html#running2to3>运行 <code>2to3</code></a>
  326. </li><li><a href=case-study-porting-chardet-to-python-3.html#multifile-modules>唠叨两句 Multi-File 模块</a>
  327. </li><li><a href=case-study-porting-chardet-to-python-3.html#manual>修正 <code>2to3</code> 未实现的功能</a>
  328. <ol>
  329. <li><a href=case-study-porting-chardet-to-python-3.html#falseisinvalidsyntax><code>False</code> 是错误的语法</a>
  330. </li><li><a href=case-study-porting-chardet-to-python-3.html#nomodulenamedconstants>没有叫做 <code>constants</code> 的模块</a>
  331. </li><li><a href=case-study-porting-chardet-to-python-3.html#namefileisnotdefined>名称 <var>'file'</var> 未定义</a>
  332. </li><li><a href=case-study-porting-chardet-to-python-3.html#cantuseastringpattern>不能对类字节对象使用字符串匹配</a>
  333. </li><li><a href=case-study-porting-chardet-to-python-3.html#cantconvertbytesobject>不能隐式地将 <code>'bytes'</code> 对象转换为 <code>str</code> </a>
  334. </li><li><a href=case-study-porting-chardet-to-python-3.html#unsupportedoperandtypeforplus>不支持的操作类型 + <code>'int'</code> <code>'bytes'</code></a>
  335. </li><li><a href=case-study-porting-chardet-to-python-3.html#ordexpectedstring><code>ord()</code> 期待长度为 1 的字符串但遇到了 <code>int</code> </a>
  336. </li><li><a href=case-study-porting-chardet-to-python-3.html#unorderabletypes>不可排序的类型 <code>int()</code> &gt;= <code>str()</code></a>
  337. </li><li><a href=case-study-porting-chardet-to-python-3.html#reduceisnotdefined>全局名称 <code>'reduce'</code> 未定义</a>
  338. </li></ol>
  339. </li><li><a href=case-study-porting-chardet-to-python-3.html#summary>摘要</a>
  340. </li></ol>
  341. </li><li id=packaging><a href=packaging.html>Python 类库打包</a>
  342. <ol>
  343. <li><a href=packaging.html#divingin>深入</a>
  344. </li><li><a href=packaging.html#cantdo>Distutils 无法为你完成的工作</a>
  345. </li><li><a href=packaging.html#structure>目录结构</a>
  346. </li><li><a href=packaging.html#setuppy>编写安装脚本</a>
  347. </li><li><a href=packaging.html#trove>将包分类</a>
  348. <ol>
  349. <li><a href=packaging.html#trove-examples>包分类的优秀范例</a>
  350. </li></ol>
  351. </li><li><a href=packaging.html#manifest>通过清单指定附加文件</a>
  352. </li><li><a href=packaging.html#check>检查安装脚本的错误</a>
  353. </li><li><a href=packaging.html#sdist>创建发布源</a>
  354. </li><li><a href=packaging.html#bdist>创建图形化安装程序</a>
  355. <ol>
  356. <li><a href=packaging.html#linux>为其它操作系统编译安装包</a>
  357. </li></ol>
  358. </li><li><a href=packaging.html#pypi>将软件添加到 Python 安装包列表</a>
  359. </li><li><a href=packaging.html#future>Python 打包工具的一些可能的将来</a>
  360. </li><li><a href=packaging.html#furtherreading>深入阅读</a>
  361. </li></ol>
  362. </li><li id=porting-code-to-python-3-with-2to3><a href=porting-code-to-python-3-with-2to3.html>使用 <code>2to3</code> 将代码移植到 Python 3</a>
  363. <ol>
  364. <li><a href=porting-code-to-python-3-with-2to3.html#divingin>深入</a>
  365. </li><li><a href=porting-code-to-python-3-with-2to3.html#print><code>print</code> 语句</a>
  366. </li><li><a href=porting-code-to-python-3-with-2to3.html#unicodeliteral>Unicode 字符串文字</a>
  367. </li><li><a href=porting-code-to-python-3-with-2to3.html#unicode><code>unicode()</code> 全局函数</a>
  368. </li><li><a href=porting-code-to-python-3-with-2to3.html#long><code>long</code> 数据类型</a>
  369. </li><li><a href=porting-code-to-python-3-with-2to3.html#ne>&lt;&gt; 比较</a>
  370. </li><li><a href=porting-code-to-python-3-with-2to3.html#has_key><code>has_key()</code> 字典方法</a>
  371. </li><li><a href=porting-code-to-python-3-with-2to3.html#dict>返回列表的字典方法</a>
  372. </li><li><a href=porting-code-to-python-3-with-2to3.html#imports>被重命名或重组的模块 reorganized</a>
  373. <ol>
  374. <li><a href=porting-code-to-python-3-with-2to3.html#http><code>http</code></a>
  375. </li><li><a href=porting-code-to-python-3-with-2to3.html#urllib><code>urllib</code></a>
  376. </li><li><a href=porting-code-to-python-3-with-2to3.html#dbm><code>dbm</code></a>
  377. </li><li><a href=porting-code-to-python-3-with-2to3.html#xmlrpc><code>xmlrpc</code></a>
  378. </li><li><a href=porting-code-to-python-3-with-2to3.html#othermodules>其它模块</a>
  379. </li></ol>
  380. </li><li><a href=porting-code-to-python-3-with-2to3.html#import>包内的相对 imports </a>
  381. </li><li><a href=porting-code-to-python-3-with-2to3.html#next><code>next()</code> 迭代器方法</a>
  382. </li><li><a href=porting-code-to-python-3-with-2to3.html#filter><code>filter()</code> 全局函数</a>
  383. </li><li><a href=porting-code-to-python-3-with-2to3.html#map><code>map()</code> 全局函数</a>
  384. </li><li><a href=porting-code-to-python-3-with-2to3.html#reduce><code>reduce()</code> 全局函数</a>
  385. </li><li><a href=porting-code-to-python-3-with-2to3.html#apply><code>apply()</code> 全局函数</a>
  386. </li><li><a href=porting-code-to-python-3-with-2to3.html#intern><code>intern()</code> 全局函数</a>
  387. </li><li><a href=porting-code-to-python-3-with-2to3.html#exec><code>exec</code> 语句</a>
  388. </li><li><a href=porting-code-to-python-3-with-2to3.html#execfile><code>execfile</code> 语句</a>
  389. </li><li><a href=porting-code-to-python-3-with-2to3.html#repr><code>repr</code> literals (backticks)</a>
  390. </li><li><a href=porting-code-to-python-3-with-2to3.html#except><code>try...except</code> 语句</a>
  391. </li><li><a href=porting-code-to-python-3-with-2to3.html#raise><code>raise</code> 语句</a>
  392. </li><li><a href=porting-code-to-python-3-with-2to3.html#throw><code>throw</code> method on generators</a>
  393. </li><li><a href=porting-code-to-python-3-with-2to3.html#xrange><code>xrange()</code> 全局函数</a>
  394. </li><li><a href=porting-code-to-python-3-with-2to3.html#raw_input><code>raw_input()</code> <code>input()</code> 全局函数</a>
  395. </li><li><a href=porting-code-to-python-3-with-2to3.html#funcattrs><code>func_*</code> 函数属性</a>
  396. </li><li><a href=porting-code-to-python-3-with-2to3.html#xreadlines><code>xreadlines()</code> I/O 方法</a>
  397. </li><li><a href=porting-code-to-python-3-with-2to3.html#tuple_params><code>lambda</code> 函数接受元组而不是多参数</a>
  398. </li><li><a href=porting-code-to-python-3-with-2to3.html#methodattrs>特别方法属性</a>
  399. </li><li><a href=porting-code-to-python-3-with-2to3.html#nonzero><code>__nonzero__</code> 特别方法</a>
  400. </li><li><a href=porting-code-to-python-3-with-2to3.html#numliterals>八进制数字</a>
  401. </li><li><a href=porting-code-to-python-3-with-2to3.html#renames><code>sys.maxint</code></a>
  402. </li><li><a href=porting-code-to-python-3-with-2to3.html#callable><code>callable()</code> 全局函数</a>
  403. </li><li><a href=porting-code-to-python-3-with-2to3.html#zip><code>zip()</code> 全局函数</a>
  404. </li><li><a href=porting-code-to-python-3-with-2to3.html#standarderror><code>StandardError</code> 例外</a>
  405. </li><li><a href=porting-code-to-python-3-with-2to3.html#types><code>types</code> 模块常量</a>
  406. </li><li><a href=porting-code-to-python-3-with-2to3.html#isinstance><code>isinstance()</code> 全局函数</a>
  407. </li><li><a href=porting-code-to-python-3-with-2to3.html#basestring><code>basestring</code> 数据类型</a>
  408. </li><li><a href=porting-code-to-python-3-with-2to3.html#itertools><code>itertools</code> 模块</a>
  409. </li><li><a href=porting-code-to-python-3-with-2to3.html#sys_exc><code>sys.exc_type</code> <code>sys.exc_value</code><code>sys.exc_traceback</code></a>
  410. </li><li><a href=porting-code-to-python-3-with-2to3.html#paren>List comprehensions over tuples</a>
  411. </li><li><a href=porting-code-to-python-3-with-2to3.html#getcwdu><code>os.getcwdu()</code> 函数</a>
  412. </li><li><a href=porting-code-to-python-3-with-2to3.html#metaclass>元类</a>
  413. </li><li><a href=porting-code-to-python-3-with-2to3.html#nitpick>风格问题</a>
  414. <ol>
  415. <li><a href=porting-code-to-python-3-with-2to3.html#set_literal><code>set()</code> literals 显式</a>
  416. </li><li><a href=porting-code-to-python-3-with-2to3.html#buffer><code>buffer()</code> 全局函数显式</a>
  417. </li><li><a href=porting-code-to-python-3-with-2to3.html#wscomma>包围逗号的空白显式</a>
  418. </li><li><a href=porting-code-to-python-3-with-2to3.html#idioms>常见习惯用法显式</a>
  419. </li></ol>
  420. </li></ol>
  421. </li><li id=special-method-names><a href=special-method-names.html>特殊方法名称</a>
  422. <ol>
  423. <li><a href=special-method-names.html#divingin>深入</a>
  424. </li><li><a href=special-method-names.html#basics>基础知识</a>
  425. </li><li><a href=special-method-names.html#acts-like-iterator>行为方式与迭代器类似的类</a>
  426. </li><li><a href=special-method-names.html#computed-attributes>计算属性</a>
  427. </li><li><a href=special-method-names.html#acts-like-function>行为方式与函数类似的类</a>
  428. </li><li><a href=special-method-names.html#acts-like-list>行为方式与序列类似的类</a>
  429. </li><li><a href=special-method-names.html#acts-like-dict>行为方式与字典类似的类</a>
  430. </li><li><a href=special-method-names.html#acts-like-number>行为方式与数值类似的类</a>
  431. </li><li><a href=special-method-names.html#rich-comparisons>可比较的类</a>
  432. </li><li><a href=special-method-names.html#pickle>可序列化的类</a>
  433. </li><li><a href=special-method-names.html#context-managers>可在 <code>with</code> 语块中使用的类</a>
  434. </li><li><a href=special-method-names.html#esoterica>真正神奇的东西</a>
  435. </li><li><a href=special-method-names.html#furtherreading>深入阅读</a>
  436. </li></ol>
  437. </li><li id=where-to-go-from-here><a href=where-to-go-from-here.html>接下来阅读什么</a>
  438. <ol>
  439. <li><a href=where-to-go-from-here.html#things-to-read>要阅读的对象</a>
  440. </li><li><a href=where-to-go-from-here.html#code>到哪里找与 Python 3-兼容的代码</a>
  441. </li></ol>
  442. </li></ol><!-- /toc -->
  443. <p class=c>© 20019 <a href=about.html>Mark Pilgrim</a>
  444. <!--[if IE]><script src=j/html5.js></script><![endif]-->