8000 docs(library/argparse.po): up to line 1986 · SkyLull/python-docs-zh-tw@697fb4c · GitHub
[go: up one dir, main page]

Skip to content

Commit 697fb4c

Browse files
committed
docs(library/argparse.po): up to line 1986
1 parent 30c0c3b commit 697fb4c

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

library/argparse.po

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,7 @@ msgid ""
17491749
"to be ``None`` instead. See the nargs_ description for examples."
17501750
msgstr ""
17511751
"當設定了選項字串(例如 ``-f`` 或 ``--foo``)給 :meth:`~ArgumentParser.add_argument` 且給予了 ``nargs='?'`` 時。"
1752-
"將建立一個能接收零或一個參數的可選選項。在剖析命令時,如果選項後方沒有對應的參數,``const`` 的值將作為預設值,若未設定則預設為 ``None``。"
1752+
"將建立一個能接收零或一個參數的可選選項。在剖析命令時,如果命令選項後方沒有對應的參數,``const`` 的值將作為預設值,若未設定則預設為 ``None``。"
17531753
"範例請見 nargs_ 的描述。"
17541754

17551755
#: ../../library/argparse.rst:895
@@ -1819,6 +1819,9 @@ msgid ""
18191819
"conversion argument, if provided, before setting the attribute on the :class:"
18201820
"`Namespace` return value. Otherwise, the parser uses the value as is::"
18211821
msgstr ""
1822+
"如果 ``default`` 值是字串,剖析器仍將其視同從命令中讀取的選項處裡。"
1823+
"若有進行設定,剖析器會依照 type_ 的設定轉換其型別後儲存進回傳的 :class:"
1824+
"`Namespace` 的屬性中。否無設定則剖析器將原封不動地使用該值。"
18221825

18231826
#: ../../library/argparse.rst:931
18241827
msgid ""
@@ -1839,6 +1842,7 @@ msgid ""
18391842
"For positional arguments with nargs_ equal to ``?`` or ``*``, the "
18401843
"``default`` value is used when no command-line argument was present::"
18411844
msgstr ""
1845+
"對於未出現在命令引數中、且設定 nargs_ 為 ``?`` 或 ``*`` 的位置引數,其 ``default`` 值將被使用:::"
18421846

18431847
#: ../../library/argparse.rst:940
18441848
msgid ""
@@ -1862,12 +1866,15 @@ msgid ""
18621866
"applies to positional arguments with nargs_ values other than ``?`` or "
18631867
"``*``, or optional arguments marked as ``required=True``."
18641868
msgstr ""
1869+
"設定為 required_ 的引數,``default`` 的設定將被忽略。"
1870+
"舉例來說,這也包括 nargs_ 不是 ``?`` 或 ``*`` 的位置引數,或設定為 ``required=True`` 的可選引數。"
18651871

18661872
#: ../../library/argparse.rst:951
18671873
msgid ""
18681874
"Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if "
18691875
"the command-line argument was not present::"
18701876
msgstr ""
1877+
"當設定 ``default=argparse.SUPPRESS`` 時,如該選項不存在命令中,則該屬性將不會被加入結果。"
18711878

18721879
#: ../../library/argparse.rst:954
18731880
msgid ""
@@ -1887,7 +1894,7 @@ msgstr ""
18871894

18881895
#: ../../library/argparse.rst:965
18891896
msgid "type"
1890-
msgstr ""
1897+
msgstr "type"
18911898

18921899
#: ../../library/argparse.rst:967
18931900
msgid ""
@@ -1897,12 +1904,15 @@ msgid ""
18971904
"keyword for :meth:`~ArgumentParser.add_argument` allows any necessary type-"
18981905
"checking and type conversions to be performed."
18991906
msgstr ""
1907+
"剖析器預設將命令列引數讀取為字串。不過,經常會遇到需要將讀取值轉換為其他定型別的狀況,例如 :class:`float` 或 :class:`int`。"
1908+
":meth:`~ArgumentParser.add_argument` 的關鍵字引數 ``type`` 可對讀取值進行必要的轉換與檢察。"
19001909

19011910
#: ../../library/argparse.rst:973
19021911
msgid ""
19031912
"If the type_ keyword is used with the default_ keyword, the type converter "
19041913
"is only applied if the default is a string."
19051914
msgstr ""
1915+
"如果 type_ 和 default_ 關鍵字被一同使用,則只有在預設值被設定為字串時才會進行型別轉換。"
19061916

19071917
#: ../../library/argparse.rst:976
19081918
msgid ""
@@ -1911,10 +1921,13 @@ msgid ""
19111921
"`ValueError`, the exception is caught and a nicely formatted error message "
19121922
"is displayed. No other exception types are handled."
19131923
msgstr ""
1924+
"傳入 ``type`` 的物件可以是任意接受一個字串輸入的可呼叫物件。"
1925+
"若呼叫該函數時發生了 :exc:`ArgumentTypeError`、:exc:`TypeError` 或 :exc:"
1926+
"`ValueError` 例外,該例外將被捕捉,並且顯示於一個格式化過的整潔訊息當中。其他未列出的例外都不會進行額外處裡。"
19141927

19151928
#: ../../library/argparse.rst:981
19161929
msgid "Common built-in types and functions can be used as type converters:"
1917-
msgstr ""
1930+
msgstr "可用於型別轉換的常用內建型別和函數:::"
19181931

19191932
#: ../../library/argparse.rst:983
19201933
msgid ""
@@ -1944,7 +1957,7 @@ msgstr ""
19441957

19451958
#: ../../library/argparse.rst:996
19461959
msgid "User defined functions can be used as well:"
1947-
msgstr ""
1960+
msgstr "也可以使用自定義的函數:::"
19481961

19491962
#: ../../library/argparse.rst:998
19501963
msgid ""
@@ -1970,6 +1983,7 @@ msgid ""
19701983
"does is convert empty strings to ``False`` and non-empty strings to "
19711984
"``True``. This is usually not what is desired."
19721985
msgstr ""
1986+
"不建議使用 :func:`bool` 函數作為型別轉換器。該函數只將空字串轉換為 ``False``,其餘都轉換為 ``True``。一般而言這不是使用者預期的行為。"
19731987

19741988
#: ../../library/argparse.rst:1012
19751989
msgid ""

0 commit comments

Comments
 (0)
0