@@ -1360,6 +1360,9 @@ msgid ""
1360
1360
"``None`` (the default) or ``'?'``, each character of the argument string "
1361
1361
"will be appended to the list. Example usage::"
1362
1362
msgstr ""
1363
+ "``'extend'`` - 这将存储一个列表并添加来自于多值参数列表的每个条目。 ``'extend'`` 动作通常配合 nargs_ 关键字参数值 "
1364
+ "``'+'`` 或 ``'*'`` 使用。 请注意当 nargs_ 为 ``None`` (默认值) 或 ``'?'`` "
1365
+ "时,将把参数字符串中的每个字符添加到列表。 示例用法::"
1363
1366
1364
1367
#: ../../library/argparse.rst:715
1365
1368
msgid ""
@@ -1433,6 +1436,7 @@ msgid ""
1433
1436
"Only actions that consume command-line arguments (e.g. ``'store'``, "
1434
1437
"``'append'`` or ``'extend'``) can be used with positional arguments."
1435
1438
msgstr ""
1439
+ "只有消耗命令行参数的动作 (例如 ``'store'``, ``'append'`` 或 ``'extend'``) 可以配合位置参数使用。"
1436
1440
1437
1441
#: ../../library/argparse.rst:752
1438
1442
msgid ""
@@ -1441,6 +1445,9 @@ msgid ""
1441
1445
":class:`!BooleanOptionalAction` is available in :mod:`!argparse` and adds "
1442
1446
"support for boolean actions such as ``--foo`` and ``--no-foo``::"
1443
1447
msgstr ""
1448
+ "你还可以通过传递一个 :class:`Action` 子类或实现了相同接口的其他对象来指定任意动作。 "
1449
+ ":class:`!BooleanOptionalAction` 在 :mod:`!argparse` 中可用并会添加对布尔类型动作如 ``--foo``"
1450
+ " 和 ``--no-foo`` 的支持::"
1444
1451
1445
1452
#: ../../library/argparse.rst:757
1446
1453
msgid ""
@@ -1464,6 +1471,9 @@ msgid ""
1464
1471
"using the :meth:`~ArgumentParser.register` method and reference them by "
1465
1472
"their registered name."
1466
1473
msgstr ""
1474
+ "创建自定义动作的推荐方式是扩展 :class:`Action`,重写 :meth:`!__call__` 方法以及可选的 "
1475
+ ":meth:`!__init__` 和 :meth:`!format_usage` 方法。 你还可以使用 "
1476
+ ":meth:`~ArgumentParser.register` 方法注册自定义动作并通过其注册名称来引用它们。"
1467
1477
1468
1478
#: ../../library/argparse.rst:770
1469
1479
msgid "An example of a custom action::"
@@ -1523,6 +1533,9 @@ msgid ""
1523
1533
"action. See also :ref:`specifying-ambiguous-arguments`. The supported values"
1524
1534
" are:"
1525
1535
msgstr ""
1536
+ ":class:`ArgumentParser` 对象通常会将一个单独的命令行参数关联到一个单独的要执行的动作。 ``nargs`` "
1537
+ "关键字参数会将不同数量的命令行参数关联到一个单独的动作。 另请参阅 :ref:`specifying-ambiguous-arguments`。 "
1538
+ "受支持的值有:"
1526
1539
1527
1540
#: ../../library/argparse.rst:803
1528
1541
msgid ""
0 commit comments