@@ -32,15 +32,14 @@ msgstr "通用的代码库问题"
3232
3333#: ../../faq/library.rst:15
3434msgid "How do I find a module or application to perform task X?"
35- msgstr "我怎么样才能找到处理某个任务可以用到的模块或者应用 ?"
35+ msgstr "如何找到可以用来做 XXX 的模块或应用 ?"
3636
3737#: ../../faq/library.rst:17
3838msgid ""
3939"Check :ref:`the Library Reference <library-index>` to see if there's a "
4040"relevant standard library module. (Eventually you'll learn what's in the "
4141"standard library and will be able to skip this step.)"
42- msgstr ""
43- "去 :ref:`代码库参考 <library-index>` 找一找有没有适合的标准库模块。(以后你将了解到标准库中的内容,并且可以跳过这一步)"
42+ msgstr "在 :ref:`代码库参考 <library-index>` 中查找是否有适合的标准库模块。(如果你已经了解标准库的内容,可以跳过这一步)"
4443
4544#: ../../faq/library.rst:21
4645msgid ""
@@ -49,8 +48,8 @@ msgid ""
4948"Web search engine. Searching for \" Python\" plus a keyword or two for your "
5049"topic of interest will usually find something helpful."
5150msgstr ""
52- "对于第三方包,在 `Python Package Index <https://pypi.org>`_ 或是 `Google "
53- "<https://www.google.com>`_ 等搜索引擎中进行搜索 。用“Python”加上一两个你关注的主题的关键字往往很有效 。"
51+ "对于第三方软件包,请搜索 `Python Package Index <https://pypi.org>`_ 或是 `Google "
52+ "<https://www.google.com>`_ 等其他搜索引擎 。用“Python”加上一两个你需要的关键字通常会找到有用的东西 。"
5453
5554#: ../../faq/library.rst:28
5655msgid "Where is the math.py (socket.py, regex.py, etc.) source file?"
@@ -64,28 +63,27 @@ msgid ""
6463":file:`mathmodule.c`, somewhere in a C source directory (not on the Python "
6564"Path)."
6665msgstr ""
67- "如果你找不到一个模块的源文件,可能它是一个内建的模块,或是使用 C,C++ "
68- "或其他编译型语言编写的动态加载模块。这种情况下是没有源码文件的,或者有也是类似 :file:`mathmodule.c` 这样存放在 C "
69- "代码目录的文件(但不在 Python 目录中)。"
66+ "如果找不到模块的源文件,可能它是一个内建的模块,或是使用 C,C++ 或其他编译型语言实现的动态加载模块。这种情况下可能是没有源码文件的,类似 "
67+ ":file:`mathmodule.c` 这样的文件会存放在 C 代码目录中(但不在 Python 目录中)。"
7068
7169#: ../../faq/library.rst:35
7270msgid "There are (at least) three kinds of modules in Python:"
7371msgstr "Python 中(至少)有三类模块:"
7472
7573#: ../../faq/library.rst:37
7674msgid "modules written in Python (.py);"
77- msgstr "使用 Python 便携的模块 (.py);"
75+ msgstr "使用 Python 编写的模块 (.py);"
7876
7977#: ../../faq/library.rst:38
8078msgid ""
8179"modules written in C and dynamically loaded (.dll, .pyd, .so, .sl, etc);"
82- msgstr "使用 C 编写的动态加载库 (.dll,.pyd,.so,.sl 等);"
80+ msgstr "使用 C 编写的动态加载模块 (.dll,.pyd,.so,.sl 等);"
8381
8482#: ../../faq/library.rst:39
8583msgid ""
8684"modules written in C and linked with the interpreter; to get a list of "
8785"these, type::"
88- msgstr "使用 C 编写并链接到解释器的模块,要获取这种模块的列表 ,输入:"
86+ msgstr "使用 C 编写并链接到解释器的模块,要获取此列表 ,输入:"
8987
9088#: ../../faq/library.rst:47
9189msgid "How do I make a Python script executable on Unix?"
@@ -102,19 +100,19 @@ msgstr "你需要做两件事:文件必须是可执行的,并且第一行需
102100msgid ""
103101"The first is done by executing ``chmod +x scriptfile`` or perhaps ``chmod "
104102"755 scriptfile``."
105- msgstr "第一点可以执行 ``chmod +x scriptfile`` 或是 ``chmod 755 scriptfile``。"
103+ msgstr "第一点可以用执行 ``chmod +x scriptfile`` 或是 ``chmod 755 scriptfile`` 做到 。"
106104
107105#: ../../faq/library.rst:56
108106msgid ""
109107"The second can be done in a number of ways. The most straightforward way is"
110108" to write ::"
111- msgstr "第二点有很多种写法 ,最直接的方式是:"
109+ msgstr "第二点有很多种做法 ,最直接的方式是:"
112110
113111#: ../../faq/library.rst:61
114112msgid ""
115113"as the very first line of your file, using the pathname for where the Python"
116114" interpreter is installed on your platform."
117- msgstr "在文件第一行,使用安装在你所在平台的 Python 解释器的路径。"
115+ msgstr "在文件第一行,使用你所在平台上的 Python 解释器的路径。"
118116
119117#: ../../faq/library.rst:64
120118msgid ""
@@ -123,32 +121,34 @@ msgid ""
123121"variants support the following, assuming the Python interpreter is in a "
124122"directory on the user's :envvar:`PATH`::"
125123msgstr ""
126- "如果你希望脚本不关心 Python 解释器的具体路径,你也可以使用 :program:`env` 程序。几乎所有的 Unix "
127- "变种都支持下面的写法,假设你的 Python 解释器所在目录已经添加到了 :envvar:`PATH` 环境变量中:"
124+ "如果你希望脚本不依赖 Python 解释器的具体路径,你也可以使用 :program:`env` 程序。假设你的 Python "
125+ "解释器所在目录已经添加到了 :envvar:`PATH` 环境变量中,几乎所有的类 Unix 系统都支持下面的写法 :"
128126
129127#: ../../faq/library.rst:71
130128msgid ""
131129"*Don't* do this for CGI scripts. The :envvar:`PATH` variable for CGI "
132130"scripts is often very minimal, so you need to use the actual absolute "
133131"pathname of the interpreter."
134- msgstr "*不要*在 CGI 脚本中这么做,CGI 脚本中的 :envvar:`PATH` 环境变量通常会非常短 ,所以你需要使用解释器的绝对路径。"
132+ msgstr "*不要*在 CGI 脚本中这么做,CGI 脚本中的 :envvar:`PATH` 环境变量通常会非常精简 ,所以你需要使用解释器的绝对路径。"
135133
136134#: ../../faq/library.rst:75
137135msgid ""
138136"Occasionally, a user's environment is so full that the "
139137":program:`/usr/bin/env` program fails; or there's no env program at all. In"
140138" that case, you can try the following hack (due to Alex Rezinsky):"
141139msgstr ""
140+ "有时候,用户的环境变量如果太长,可能会导致 :program:`/usr/bin/env` 执行失败;又或者甚至根本就不存在 env "
141+ "程序。在这种情况下,你可以尝试使用下面的 hack 方法(来自 Alex Rezinsky):"
142142
143143#: ../../faq/library.rst:86
144144msgid ""
145145"The minor disadvantage is that this defines the script's __doc__ string. "
146146"However, you can fix that by adding ::"
147- msgstr ""
147+ msgstr "这样做有一个小小的缺点,它会定义脚本的 __doc__ 字符串。不过可以这样修复: "
148148
149149#: ../../faq/library.rst:94
150150msgid "Is there a curses/termcap package for Python?"
151- msgstr ""
151+ msgstr "Python 中有 curses / termcap 包吗? "
152152
153153#: ../../faq/library.rst:98
154154msgid ""
@@ -157,6 +157,8 @@ msgid ""
157157"compiled by default. (Note that this is not available in the Windows "
158158"distribution -- there is no curses module for Windows.)"
159159msgstr ""
160+ "对于类 Unix 系统:标准 Python 源码发行版会在 :source:`Modules` 子目录中附带 curses "
161+ "模块,但默认并不会编译。(注意:在 Windows 平台下不可用 —— Windows 中没有 curses 模块。)"
160162
161163#: ../../faq/library.rst:103
162164msgid ""
@@ -167,57 +169,64 @@ msgid ""
167169"but there don't seem to be any currently maintained OSes that fall into this"
168170" category."
169171msgstr ""
172+ ":mod:`curses` 模块支持基本的 curses 特性,同时也支持 ncurses 和 SYSV curses "
173+ "中的很多额外功能,比如颜色、不同的字符集支持、填充和鼠标支持。这意味着这个模块不兼容只有 BSD curses "
174+ "模块的操作系统,但是目前仍在维护的系统应该都不会存在这种情况。"
170175
171176#: ../../faq/library.rst:109
172177msgid ""
173178"For Windows: use `the consolelib module <http://effbot.org/zone/console-"
174179"index.htm>`_."
175180msgstr ""
181+ "对于 Windows 平台:使用 `consolelib 模块 <http://effbot.org/zone/console-"
182+ "index.htm>`_."
176183
177184#: ../../faq/library.rst:114
178185msgid "Is there an equivalent to C's onexit() in Python?"
179- msgstr ""
186+ msgstr "Python 中存在类似 C 的 onexit() 函数的东西吗? "
180187
181188#: ../../faq/library.rst:116
182189msgid ""
183190"The :mod:`atexit` module provides a register function that is similar to C's"
184191" :c:func:`onexit`."
185- msgstr ""
192+ msgstr ":mod:`atexit` 模块提供了一个与 C 的 :c:func:`onexit` 函数类似的注册函数。 "
186193
187194#: ../../faq/library.rst:121
188195msgid "Why don't my signal handlers work?"
189- msgstr ""
196+ msgstr "为什么我的信号处理函数不能工作? "
190197
191198#: ../../faq/library.rst:123
192199msgid ""
193200"The most common problem is that the signal handler is declared with the "
194201"wrong argument list. It is called as ::"
195- msgstr ""
202+ msgstr "最常见的问题是信号处理函数没有正确定义参数列表。它会被这样调用: "
196203
197204#: ../../faq/library.rst:128
198205msgid "so it should be declared with two arguments::"
199- msgstr ""
206+ msgstr "因此函数应该定义两个参数: "
200207
201208#: ../../faq/library.rst:135
202209msgid "Common tasks"
203- msgstr ""
210+ msgstr "通用任务 "
204211
205212#: ../../faq/library.rst:138
206213msgid "How do I test a Python program or component?"
207- msgstr ""
214+ msgstr "怎样测试 Python 程序或组件? "
208215
209216#: ../../faq/library.rst:140
210217msgid ""
211218"Python comes with two testing frameworks. The :mod:`doctest` module finds "
212219"examples in the docstrings for a module and runs them, comparing the output "
213220"with the expected output given in the docstring."
214221msgstr ""
222+ "Python 带有两个测试框架。:mod:`doctest` 模块从模块的 docstring 中寻找示例并执行,对比输出是否与 docstring "
223+ "中给出的是否一致。"
215224
216225#: ../../faq/library.rst:144
217226msgid ""
218227"The :mod:`unittest` module is a fancier testing framework modelled on Java "
219228"and Smalltalk testing frameworks."
220- msgstr ""
229+ msgstr ":mod:`unittest` 模块是一个模仿 Java 和 Smalltalk 测试框架的更棒的测试框架。 "
221230
222231#: ../../faq/library.rst:147
223232msgid ""
0 commit comments