@@ -1749,7 +1749,7 @@ msgid ""
1749
1749
"to be ``None`` instead. See the nargs_ description for examples."
1750
1750
msgstr ""
1751
1751
"當設定了選項字串(例如 ``-f`` 或 ``--foo``)給 :meth:`~ArgumentParser.add_argument` 且給予了 ``nargs='?'`` 時。"
1752
- "將建立一個能接收零或一個參數的可選選項。在剖析命令時,如果選項後方沒有對應的參數 ,``const`` 的值將作為預設值,若未設定則預設為 ``None``。"
1752
+ "將建立一個能接收零或一個參數的可選選項。在剖析命令時,如果命令選項後方沒有對應的參數 ,``const`` 的值將作為預設值,若未設定則預設為 ``None``。"
1753
1753
"範例請見 nargs_ 的描述。"
1754
1754
1755
1755
#: ../../library/argparse.rst:895
@@ -1819,6 +1819,9 @@ msgid ""
1819
1819
"conversion argument, if provided, before setting the attribute on the :class:"
1820
1820
"`Namespace` return value. Otherwise, the parser uses the value as is::"
1821
1821
msgstr ""
1822
+ "如果 ``default`` 值是字串,剖析器仍將其視同從命令中讀取的選項處裡。"
1823
+ "若有進行設定,剖析器會依照 type_ 的設定轉換其型別後儲存進回傳的 :class:"
1824
+ "`Namespace` 的屬性中。否無設定則剖析器將原封不動地使用該值。"
1822
1825
1823
1826
#: ../../library/argparse.rst:931
1824
1827
msgid ""
@@ -1839,6 +1842,7 @@ msgid ""
1839
1842
"For positional arguments with nargs_ equal to ``?`` or ``*``, the "
1840
1843
"``default`` value is used when no command-line argument was present::"
1841
1844
msgstr ""
1845
+ "對於未出現在命令引數中、且設定 nargs_ 為 ``?`` 或 ``*`` 的位置引數,其 ``default`` 值將被使用:::"
1842
1846
1843
1847
#: ../../library/argparse.rst:940
1844
1848
msgid ""
@@ -1862,12 +1866,15 @@ msgid ""
1862
1866
"applies to positional arguments with nargs_ values other than ``?`` or "
1863
1867
"``*``, or optional arguments marked as ``required=True``."
1864
1868
msgstr ""
1869
+ "設定為 required_ 的引數,``default`` 的設定將被忽略。"
1870
+ "舉例來說,這也包括 nargs_ 不是 ``?`` 或 ``*`` 的位置引數,或設定為 ``required=True`` 的可選引數。"
1865
1871
1866
1872
#: ../../library/argparse.rst:951
1867
1873
msgid ""
1868
1874
"Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if "
1869
1875
"the command-line argument was not present::"
1870
1876
msgstr ""
1877
+ "當設定 ``default=argparse.SUPPRESS`` 時,如該選項不存在命令中,則該屬性將不會被加入結果。"
1871
1878
1872
1879
#: ../../library/argparse.rst:954
1873
1880
msgid ""
@@ -1887,7 +1894,7 @@ msgstr ""
1887
1894
1888
1895
#: ../../library/argparse.rst:965
1889
1896
msgid "type"
1890
- msgstr ""
1897
+ msgstr "type "
1891
1898
1892
1899
#: ../../library/argparse.rst:967
1893
1900
msgid ""
@@ -1897,12 +1904,15 @@ msgid ""
1897
1904
"keyword for :meth:`~ArgumentParser.add_argument` allows any necessary type-"
1898
1905
"checking and type conversions to be performed."
1899
1906
msgstr ""
1907
+ "剖析器預設將命令列引數讀取為字串。不過,經常會遇到需要將讀取值轉換為其他定型別的狀況,例如 :class:`float` 或 :class:`int`。"
1908
+ ":meth:`~ArgumentParser.add_argument` 的關鍵字引數 ``type`` 可對讀取值進行必要的轉換與檢察。"
1900
1909
1901
1910
#: ../../library/argparse.rst:973
1902
1911
msgid ""
1903
1912
"If the type_ keyword is used with the default_ keyword, the type converter "
1904
1913
"is only applied if the default is a string."
1905
1914
msgstr ""
1915
+ "如果 type_ 和 default_ 關鍵字被一同使用,則只有在預設值被設定為字串時才會進行型別轉換。"
1906
1916
1907
1917
#: ../../library/argparse.rst:976
1908
1918
msgid ""
@@ -1911,10 +1921,13 @@ msgid ""
1911
1921
"`ValueError`, the exception is caught and a nicely formatted error message "
1912
1922
"is displayed. No other exception types are handled."
1913
1923
msgstr ""
1924
+ "傳入 ``type`` 的物件可以是任意接受一個字串輸入的可呼叫物件。"
1925
+ "若呼叫該函數時發生了 :exc:`ArgumentTypeError`、:exc:`TypeError` 或 :exc:"
1926
+ "`ValueError` 例外,該例外將被捕捉,並且顯示於一個格式化過的整潔訊息當中。其他未列出的例外都不會進行額外處裡。"
1914
1927
1915
1928
#: ../../library/argparse.rst:981
1916
1929
msgid "Common built-in types and functions can be used as type converters:"
1917
- msgstr ""
1930
+ msgstr "可用於型別轉換的常用內建型別和函數::: "
1918
1931
1919
1932
#: ../../library/argparse.rst:983
1920
1933
msgid ""
@@ -1944,7 +1957,7 @@ msgstr ""
1944
1957
1945
1958
#: ../../library/argparse.rst:996
1946
1959
msgid "User defined functions can be used as well:"
1947
- msgstr ""
1960
+ msgstr "也可以使用自定義的函數::: "
1948
1961
1949
1962
#: ../../library/argparse.rst:998
1950
1963
msgid ""
@@ -1970,6 +1983,7 @@ msgid ""
1970
1983
"does is convert empty strings to ``False`` and non-empty strings to "
1971
1984
"``True``. This is usually not what is desired."
1972
1985
msgstr ""
1986
+ "不建議使用 :func:`bool` 函數作為型別轉換器。該函數只將空字串轉換為 ``False``,其餘都轉換為 ``True``。一般而言這不是使用者預期的行為。"
1973
1987
1974
1988
#: ../../library/argparse.rst:1012
1975
1989
msgid ""