@@ -52,6 +52,10 @@ msgid ""
52
52
"option parameter values that start with ``-`` even when they correspond to "
53
53
"another defined option)."
54
54
msgstr ""
55
+ "虽然 :mod:`argparse` "
56
+ "是推荐的用于实现基本命令行应用程序的标准库模块,但对于命令行应用程序的行为有更明确的要求的开发者可能会发现它并未提供所需层次的控制能力。 请参阅 "
57
+ ":ref:`choosing-an-argument-parser` 了解当 ``argparse`` "
58
+ "不支持特定应用程序需要的行为(例如完全禁用散开选项和位置参数,或接受以 ``-`` 开头的选项形参值即使它们对应了其它已定义的选项)时可以考虑的替代。"
55
59
56
60
#: ../../library/argparse.rst-1
57
61
msgid "Tutorial"
@@ -737,6 +741,9 @@ msgid ""
737
741
" for options like ``+f`` or ``/foo``, may specify them using the "
738
742
"``prefix_chars=`` argument to the :class:`ArgumentParser` constructor::"
739
743
msgstr ""
744
+ "大多数命令行选项会使用 ``-`` 作为前缀,例如 ``-f/--foo``。 如果解析器需要支持不同的或者额外的前缀字符,例如像 ``+f`` 或 "
745
+ "``/foo`` 之类的选项,可以在 :class:`ArgumentParser` 构造器中使用 ``prefix_chars=`` "
746
+ "参数来指定它们::"
740
747
741
748
#: ../../library/argparse.rst:389
742
749
msgid ""
@@ -1963,6 +1970,9 @@ msgid ""
1963
1970
"the parser has run and then use the :keyword:`with`-statement to manage the "
1964
1971
"files."
1965
1972
msgstr ""
1973
+ "甚至 :class:`~argparse.FileType` 在用于 ``type`` 关键字时也是有限制的。 如果一个参数使用了 "
1974
+ ":class:`~argparse.FileType` 并且有一个后续参数出错,则将报告错误但文件并不会被自动关闭。 "
1975
+ "在此情况下,更好的做法是等待直到解析器运行完毕再使用 :keyword:`with` 语句来管理文件。"
1966
1976
1967
1977
#: ../../library/argparse.rst:1043
1968
1978
msgid ""
@@ -2012,6 +2022,8 @@ msgid ""
2012
2022
"conversions have been performed, so the type of the objects in the *choices*"
2013
2023
" sequence should match the type_ specified."
2014
2024
msgstr ""
2025
+ "注意包括在 *choices* 序列中的内容会在执行任意 type_ 转换之后被检查,因此 *choices* 序列中对象的类型应当与指定的 type_"
2026
+ " 相匹配。"
2015
2027
2016
2028
#: ../../library/argparse.rst:1071
2017
2029
msgid ""
0 commit comments