@@ -501,45 +501,52 @@ msgstr "例如 ::"
501
501
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:335
502
502
msgid ""
503
503
"Now let's make up a fake command line and ask :mod:`optparse` to parse it::"
504
- msgstr ""
504
+ msgstr "现在让我们编一个虚假的命令行并让 :mod:`optparse` 来解析它:: "
505
505
506
506
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:340
507
507
msgid ""
508
508
"When :mod:`optparse` sees the option string ``-f``, it consumes the next "
509
509
"argument, ``foo.txt``, and stores it in ``options.filename``. So, after "
510
510
"this call to :meth:`parse_args`, ``options.filename`` is ``\" foo.txt\" ``."
511
511
msgstr ""
512
+ "当 :mod:`optparse` 看到选项字符串 ``-f`` 时,它将获取下一个参数 ``foo.txt``,并将其保存到 "
513
+ "``options.filename`` 中。 因此,在这个对 :meth:`parse_args` "
514
+ "的调用之后,``options.filename`` 将为 ``\" foo.txt\" ``。"
512
515
513
516
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:344
514
517
msgid ""
515
518
"Some other option types supported by :mod:`optparse` are ``int`` and "
516
519
"``float``. Here's an option that expects an integer argument::"
517
- msgstr ""
520
+ msgstr "受到 :mod:`optparse` 支持的其他一些选项类型有 ``int`` 和 ``float``。 下面是一个接受整数参数的选项:: "
518
521
519
522
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:349
520
523
msgid ""
521
524
"Note that this option has no long option string, which is perfectly "
522
525
"acceptable. Also, there's no explicit action, since the default is "
523
526
"``store``."
524
- msgstr ""
527
+ msgstr "请注意这个选项没有长选项字符串,这是完全可接受的。 而且,它也没有显式的动作,因为使用默认的 ``store``。 "
525
528
526
529
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:352
527
530
msgid ""
528
531
"Let's parse another fake command-line. This time, we'll jam the option "
529
532
"argument right up against the option: since ``-n42`` (one argument) is "
530
533
"equivalent to ``-n 42`` (two arguments), the code ::"
531
534
msgstr ""
535
+ "让我们解析另一个虚假的命令行。 这一次,我们将让选项参数与选项紧贴在一起:因为 ``-n42`` (一个参数) 与 ``-n 42`` (两个参数) "
536
+ "是等价的,以下代码 ::"
532
537
533
538
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:359
534
539
msgid "will print ``42``."
535
- msgstr ""
540
+ msgstr "将会打印 ``42``。 "
536
541
537
542
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:361
538
543
msgid ""
539
544
"If you don't specify a type, :mod:`optparse` assumes ``string``. Combined "
540
545
"with the fact that the default action is ``store``, that means our first "
541
546
"example can be a lot shorter::"
542
547
msgstr ""
548
+ "如果你没有指明类型,:mod:`optparse` 会假定类型为 ``string``。 加上默认动作为 ``store`` "
549
+ "这一事实,意味着我们的第一个示例可以变得更加简短::"
543
550
544
551
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:367
545
552
msgid ""
@@ -549,16 +556,21 @@ msgid ""
549
556
"option strings, :mod:`optparse` looks at the first short option string: the "
550
557
"default destination for ``-f`` is ``f``."
551
558
msgstr ""
559
+ "如果你没有提供目标,:mod:`optparse` 会从选项字符串推断出一个合理的默认目标:如果第一个长选项字符串为 ``--foo-"
560
+ "bar``,则默认目标为 ``foo_bar``。 如果没有长选项字符串,则 :mod:`optparse` 会查找第一个短选项字符串:针对 "
561
+ "``-f`` 的默认目标将为 ``f``。"
552
562
553
563
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:373
554
564
msgid ""
555
565
":mod:`optparse` also includes the built-in ``complex`` type. Adding types "
556
566
"is covered in section :ref:`optparse-extending-optparse`."
557
567
msgstr ""
568
+ ":mod:`optparse` 还包括了内置的 ``complex`` 类型。 添加类型的方式将在 :ref:`optparse-extending-"
569
+ "optparse` 一节中介绍。"
558
570
559
571
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:380
560
572
msgid "Handling boolean (flag) options"
561
- msgstr ""
573
+ msgstr "处理布尔值(旗标)选项 "
562
574
563
575
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:382
564
576
msgid ""
0 commit comments