@@ -95,11 +95,11 @@ msgstr "使用 :mod:`argparse` 的第一步是创建一个 :class:`ArgumentParse
9595msgid ""
9696"The :class:`ArgumentParser` object will hold all the information necessary "
9797"to parse the command line into Python data types."
98- msgstr ""
98+ msgstr ":class:`ArgumentParser` 对象包含将命令行解析成 Python 数据类型所需的全部信息。 "
9999
100100#: ../../library/argparse.rst:99
101101msgid "Adding arguments"
102- msgstr ""
102+ msgstr "添加参数 "
103103
104104#: ../../library/argparse.rst:101
105105msgid ""
@@ -110,6 +110,9 @@ msgid ""
110110" stored and used when :meth:`~ArgumentParser.parse_args` is called. For "
111111"example::"
112112msgstr ""
113+ "给一个 :class:`ArgumentParser` 添加程序参数信息是通过调用 "
114+ ":meth:`~ArgumentParser.add_argument` 方法完成的。通常,这些调用指定 :class:`ArgumentParser`"
115+ " 如何获取命令行字符串并将其转换为对象。这些信息在 :meth:`~ArgumentParser.parse_args` 调用时被存储和使用。例如:"
113116
114117#: ../../library/argparse.rst:113
115118msgid ""
@@ -119,6 +122,9 @@ msgid ""
119122"attribute will be either the :func:`sum` function, if ``--sum`` was "
120123"specified at the command line, or the :func:`max` function if it was not."
121124msgstr ""
125+ "稍后,调用 :meth:`~ArgumentParser.parse_args` 将返回一个具有 ``integers`` 和 "
126+ "``accumulate`` 两个属性的对象。``integers`` 属性将是一个包含一个或多个整数的列表,而 ``accumulate`` "
127+ "属性当命令行中指定了 ``--sum`` 参数时将是 :func:`sum` 函数,否则则是 :func:`max` 函数。"
122128
123129#: ../../library/argparse.rst:121
124130msgid "Parsing arguments"
@@ -132,53 +138,60 @@ msgid ""
132138"appropriate action. In most cases, this means a simple :class:`Namespace` "
133139"object will be built up from attributes parsed out of the command line::"
134140msgstr ""
141+ ":class:`ArgumentParser` 通过 :meth:`~ArgumentParser.parse_args` "
142+ "方法解析参数。它将检查命令行,把每个参数转换为适当的类型然后调用相应的操作。在大多数情况下,这意味着一个简单的 :class:`Namespace` "
143+ "对象将从命令行参数中解析出的属性构建:"
135144
136145#: ../../library/argparse.rst:132
137146msgid ""
138147"In a script, :meth:`~ArgumentParser.parse_args` will typically be called "
139148"with no arguments, and the :class:`ArgumentParser` will automatically "
140149"determine the command-line arguments from :data:`sys.argv`."
141150msgstr ""
151+ "在脚本中,通常 :meth:`~ArgumentParser.parse_args` 会被不带参数调用,而 "
152+ ":class:`ArgumentParser` 将自动从 :data:`sys.argv` 中确定命令行参数。"
142153
143154#: ../../library/argparse.rst:138
144155msgid "ArgumentParser objects"
145- msgstr ""
156+ msgstr "ArgumentParser 对象 "
146157
147158#: ../../library/argparse.rst:147
148159msgid ""
149160"Create a new :class:`ArgumentParser` object. All parameters should be passed"
150161" as keyword arguments. Each parameter has its own more detailed description "
151162"below, but in short they are:"
152163msgstr ""
164+ "创建一个新的 :class:`ArgumentParser` "
165+ "对象。所有的参数都应当作为关键字参数传入。每个参数在下面都有它更详细的描述,但简而言之,它们是:"
153166
154167#: ../../library/argparse.rst:151
155168msgid "prog_ - The name of the program (default: ``sys.argv[0]``)"
156- msgstr ""
169+ msgstr "prog_ - 程序的名称(默认:``sys.argv[0]``) "
157170
158171#: ../../library/argparse.rst:153
159172msgid ""
160173"usage_ - The string describing the program usage (default: generated from "
161174"arguments added to parser)"
162- msgstr ""
175+ msgstr "usage_ - 描述程序用途的字符串(默认值:从添加到解析器的参数生成) "
163176
164177#: ../../library/argparse.rst:156
165178msgid ""
166179"description_ - Text to display before the argument help (default: none)"
167- msgstr ""
180+ msgstr "description_ - 在参数帮助文档之前显示的文本(默认值:无) "
168181
169182#: ../../library/argparse.rst:158
170183msgid "epilog_ - Text to display after the argument help (default: none)"
171- msgstr ""
184+ msgstr "epilog_ - 在参数帮助文档之后显示的文本(默认值:无) "
172185
173186#: ../../library/argparse.rst:160
174187msgid ""
175188"parents_ - A list of :class:`ArgumentParser` objects whose arguments should "
176189"also be included"
177- msgstr ""
190+ msgstr "parents_ - 一个 :class:`ArgumentParser` 对象的列表,它们的参数也应包含在内 "
178191
179192#: ../../library/argparse.rst:163
180193msgid "formatter_class_ - A class for customizing the help output"
181- msgstr ""
194+ msgstr "formatter_class_ - 用于自定义帮助文档输出格式的类 "
182195
183196#: ../../library/argparse.rst:165
184197msgid ""
0 commit comments