99# Trim21 <[email protected] >, 201910101111# allenjuly7 <[email protected] >, 201912- # Siyuan Xu <[email protected] >, 2019131213+ # Siyuan Xu <[email protected] >, 20201414#
1515#, fuzzy
1616msgid ""
@@ -19,7 +19,7 @@ msgstr ""
1919"Report-Msgid-Bugs-To : \n "
2020"POT-Creation-Date : 2020-02-09 12:40+0000\n "
2121"PO-Revision-Date : 2017-02-16 17:44+0000\n "
22- "Last-Translator : 汪心禾 <wangxinhe06@gmail .com>, 2019 \n "
22+ "Last-Translator : Siyuan Xu <mf20070535@126 .com>, 2020 \n "
2323"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
2424"MIME-Version : 1.0\n "
2525"Content-Type : text/plain; charset=UTF-8\n "
@@ -187,6 +187,8 @@ msgid ""
187187"also notice that its name matches the string argument given to the method, "
188188"``echo``."
189189msgstr ""
190+ "这一变量是 :mod:`argparse` 免费施放的某种 "
191+ "“魔法”(即是说,不需要指定哪个变量是存储哪个值的)。你也可以注意到,这一名称与传递给方法的字符串参数一致,都是 ``echo``。"
190192
191193#: ../../howto/argparse.rst:154
192194msgid ""
@@ -196,27 +198,31 @@ msgid ""
196198"than by guessing or by reading the source code. So, let's make it a bit more"
197199" useful::"
198200msgstr ""
201+ "然而请注意,尽管显示的帮助看起来清楚完整,但它可以比现在更有帮助。比如我们可以知道 ``echo`` "
202+ "是一个位置参数,但我们除了靠猜或者看源代码,没法知道它是用来干什么的。所以,我们可以把它改造得更有用:"
199203
200204#: ../../howto/argparse.rst:165
201205msgid "And we get:"
202206msgstr "然后我们得到:"
203207
204208#: ../../howto/argparse.rst:178
205209msgid "Now, how about doing something even more useful::"
206- msgstr "现在,做一些更有用的事情怎么样:: "
210+ msgstr "现在,来做一些更有用的事情: "
207211
208212#: ../../howto/argparse.rst:196
209213msgid ""
210214"That didn't go so well. That's because :mod:`argparse` treats the options we"
211215" give it as strings, unless we tell it otherwise. So, let's tell "
212216":mod:`argparse` to treat that input as an integer::"
213217msgstr ""
218+ "进展不太顺利。那是因为 :mod:`argparse` 会把我们传递给它的选项视作为字符串,除非我们告诉它别这样。所以,让我们来告诉 "
219+ ":mod:`argparse` 来把这一输入视为整数:"
214220
215221#: ../../howto/argparse.rst:217
216222msgid ""
217223"That went well. The program now even helpfully quits on bad illegal input "
218224"before proceeding."
219- msgstr ""
225+ msgstr "做得不错。当这个程序在收到错误的无效的输入时,它甚至能在执行计算之前先退出,还能显示很有帮助的错误信息。 "
220226
221227#: ../../howto/argparse.rst:222
222228msgid "Introducing Optional arguments"
@@ -226,7 +232,7 @@ msgstr "可选参数介绍"
226232msgid ""
227233"So far we have been playing with positional arguments. Let us have a look on"
228234" how to add optional ones::"
229- msgstr "到目前为止,我们一直在研究位置参数。让我们看看如何添加可选的:: "
235+ msgstr "到目前为止,我们一直在研究位置参数。让我们看看如何添加可选的: "
230236
231237#: ../../howto/argparse.rst:234 ../../howto/argparse.rst:280
232238#: ../../howto/argparse.rst:396 ../../howto/argparse.rst:430
@@ -237,7 +243,7 @@ msgstr "和输出:"
237243msgid ""
238244"The program is written so as to display something when ``--verbosity`` is "
239245"specified and display nothing when not."
240- msgstr ""
246+ msgstr "这一程序被设计为当指定 ``--verbosity`` 选项时显示某些东西,否则不显示。 "
241247
242248#: ../../howto/argparse.rst:257
243249msgid ""
@@ -247,6 +253,8 @@ msgid ""
247253"``None`` as a value, which is the reason it fails the truth test of the "
248254":keyword:`if` statement."
249255msgstr ""
256+ "不添加这一选项时程序没有提示任何错误而退出,表明这一选项确实是可选的。注意,如果一个可选参数没有被使用时,相关变量被赋值为 ``None``,在此例中是"
257+ " :attr:`args.verbosity`,这也就是为什么它在 :keyword:`if` 语句中被当作逻辑假。"
250258
251259#: ../../howto/argparse.rst:263
252260msgid "The help message is a bit different."
@@ -256,14 +264,16 @@ msgstr "帮助信息有点不同。"
256264msgid ""
257265"When using the ``--verbosity`` option, one must also specify some value, any"
258266" value."
259- msgstr "使用 ``--verbosity`` 选项时,必须指定一些值(任何值) 。"
267+ msgstr "使用 ``--verbosity`` 选项时,必须指定一个值,但可以是任何值 。"
260268
261269#: ../../howto/argparse.rst:268
262270msgid ""
263271"The above example accepts arbitrary integer values for ``--verbosity``, but "
264272"for our simple program, only two values are actually useful, ``True`` or "
265273"``False``. Let's modify the code accordingly::"
266274msgstr ""
275+ "上述例子接受任何整数值作为 ``--verbosity`` 的参数,但对于我们的简单程序而言,只有两个值有实际意义:``True`` 或者 "
276+ "``False``。让我们据此修改代码:"
267277
268278#: ../../howto/argparse.rst:298
269279msgid ""
@@ -273,12 +283,15 @@ msgid ""
273283" This means that, if the option is specified, assign the value ``True`` to "
274284":data:`args.verbose`. Not specifying it implies ``False``."
275285msgstr ""
286+ "现在,这一选项更多地是一个标志,而非需要接受一个值的什么东西。我们甚至改变了选项的名字来符合这一思路。注意我们现在指定了一个新的关键词 "
287+ "``action``,并赋值为 ``\" store_true\" ``。这意味着,当这一选项存在时,为 :data:`args.verbose` 赋值为 "
288+ "``True``。没有指定时则隐含地赋值为 ``False``。"
276289
277290#: ../../howto/argparse.rst:305
278291msgid ""
279292"It complains when you specify a value, in true spirit of what flags actually"
280293" are."
281- msgstr ""
294+ msgstr "当你为其指定一个值时,它会报错,符合作为标志的真正的精神。 "
282295
283296#: ../../howto/argparse.rst:308
284297msgid "Notice the different help text."
@@ -293,31 +306,31 @@ msgid ""
293306"If you are familiar with command line usage, you will notice that I haven't "
294307"yet touched on the topic of short versions of the options. It's quite "
295308"simple::"
296- msgstr ""
309+ msgstr "如果你熟悉命令行的用法,你会发现我还没讲到这一选项的短版本。这也很简单: "
297310
298311#: ../../howto/argparse.rst:326
299312msgid "And here goes:"
300- msgstr ""
313+ msgstr "效果就像这样: "
301314
302315#: ../../howto/argparse.rst:339
303316msgid "Note that the new ability is also reflected in the help text."
304- msgstr ""
317+ msgstr "可以注意到,这一新的能力也反映在帮助文本里。 "
305318
306319#: ../../howto/argparse.rst:343
307320msgid "Combining Positional and Optional arguments"
308321msgstr "结合位置参数和可选参数"
309322
310323#: ../../howto/argparse.rst:345
311324msgid "Our program keeps growing in complexity::"
312- msgstr "我们的程序变得越来越复杂了:: "
325+ msgstr "我们的程序变得越来越复杂了: "
313326
314327#: ../../howto/argparse.rst:360
315328msgid "And now the output:"
316329msgstr "接着是输出:"
317330
318331#: ../../howto/argparse.rst:374
319332msgid "We've brought back a positional argument, hence the complaint."
320- msgstr ""
333+ msgstr "我们带回了一个位置参数,结果发生了报错。 "
321334
322335#: ../../howto/argparse.rst:376
323336msgid "Note that the order does not matter."
0 commit comments