@@ -1690,6 +1690,8 @@ msgid ""
1690
1690
"be produced. Actions that do not consume command-line arguments (e.g. "
1691
1691
"``'store_const'``) set ``nargs=0``."
1692
1692
msgstr ""
1693
+ "如果未提供 ``nargs`` 关键字参数,则消耗参数的数量将由 action_ 来确定。 通常这意味着消耗一个命令行参数并产生一个条目(而非列表)。 "
1694
+ "不消耗命令行参数的动作 (例如 ``'store_const'``) 则要设置 ``nargs=0``。"
1693
1695
1694
1696
#: ../../library/argparse.rst:887
1695
1697
msgid "const"
@@ -1901,6 +1903,9 @@ msgid ""
1901
1903
":exc:`ValueError`, the exception is caught and a nicely formatted error "
1902
1904
"message is displayed. Other exception types are not handled."
1903
1905
msgstr ""
1906
+ "传给 ``type`` 的参数可以是接受一个字符串或一个已注册类型名称 (参见 :meth:`~ArgumentParser.register`) "
1907
+ "的可调用对象。 如果该函数引发了 :exc:`ArgumentTypeError`, :exc:`TypeError` 或 "
1908
+ ":exc:`ValueError`,异常将被捕获并显示经良好格式化的错误消息。 其他异常类型则不会被处理。"
1904
1909
1905
1910
#: ../../library/argparse.rst:995
1906
1911
msgid "Common built-in types and functions can be used as type converters:"
@@ -2080,6 +2085,9 @@ msgid ""
2080
2085
"command line. To make an option *required*, ``True`` can be specified for "
2081
2086
"the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::"
2082
2087
msgstr ""
2088
+ "通常,:mod:`!argparse` 模块会假定像 ``-f`` 和 ``--bar`` 这样的旗标是表示 *可选* "
2089
+ "参数,它们总是可以在命令行中被省略。 要让一个选项成为 *必需*,则可以将 ``True`` 作为 ``required=`` 关键字参数传给 "
2090
+ ":meth:`~ArgumentParser.add_argument`::"
2083
2091
2084
2092
#: ../../library/argparse.rst:1093
2085
2093
msgid ""
@@ -2125,6 +2133,8 @@ msgid ""
2125
2133
"at the command line), these ``help`` descriptions will be displayed with "
2126
2134
"each argument."
2127
2135
msgstr ""
2136
+ "``help`` 值是一个包含参数的简短描述的字符串。 当用户请求帮助时(一般是通过在命令行中使用 ``-h`` 或 ``--help`` "
2137
+ "的方式),这些 ``help`` 描述信息将随每个参数一同显示。"
2128
2138
2129
2139
#: ../../library/argparse.rst:1121
2130
2140
msgid ""
@@ -2175,6 +2185,7 @@ msgid ""
2175
2185
":mod:`!argparse` supports silencing the help entry for certain options, by "
2176
2186
"setting the ``help`` value to ``argparse.SUPPRESS``::"
2177
2187
msgstr ""
2188
+ ":mod:`!argparse` 支持静默特定选面的帮助条目,具体方式是将 ``help`` 值设为 ``argparse.SUPPRESS``::"
2178
2189
2179
2190
#: ../../library/argparse.rst:1144
2180
2191
msgid ""
0 commit comments