diff --git a/tutorial/interpreter.po b/tutorial/interpreter.po index efeb3092b..a5d6c5408 100644 --- a/tutorial/interpreter.po +++ b/tutorial/interpreter.po @@ -1,83 +1,87 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2021, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. -# +# # Translators: # Jerry Chen , 2017 # 启迪 吴 , 2017 # cdarlint , 2017 # jaystone776 <1732865113@qq.com>, 2021 -# -#, fuzzy +# Liang-Bo Wang , 2015-2016 +# Steven Hsu , 2021 msgid "" msgstr "" "Project-Id-Version: Python 3.9\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-01-01 05:02+0000\n" -"PO-Revision-Date: 2017-02-16 23:40+0000\n" -"Last-Translator: jaystone776 <1732865113@qq.com>, 2021\n" -"Language-Team: Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n" +"POT-Creation-Date: 2020-06-20 18:08+0800\n" +"PO-Revision-Date: 2021-04-29 04:32+0800\n" +"Last-Translator: Adrian Liaw \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: zh_CN\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 2.4.3\n" #: ../../tutorial/interpreter.rst:5 msgid "Using the Python Interpreter" -msgstr "Python 解释器" +msgstr "使用 Python 直譯器" #: ../../tutorial/interpreter.rst:11 msgid "Invoking the Interpreter" -msgstr "调用解释器" +msgstr "啟動直譯器" #: ../../tutorial/interpreter.rst:13 msgid "" -"The Python interpreter is usually installed as " -":file:`/usr/local/bin/python3.9` on those machines where it is available; " -"putting :file:`/usr/local/bin` in your Unix shell's search path makes it " -"possible to start it by typing the command:" +"The Python interpreter is usually installed as :file:`/usr/local/bin/" +"python3.9` on those machines where it is available; putting :file:`/usr/" +"local/bin` in your Unix shell's search path makes it possible to start it by " +"typing the command:" msgstr "" -"Python 解释器一般安装在 :file:`/usr/local/bin/python3.9` 路径下;将 " -":file:`/usr/local/bin` 加入 Unix 终端的搜索路径,键入以下命令就可以启动 Python:" +"Python解釋器一般安裝在 :file:`/usr/local/bin/python3.9` 路徑下;將 :file:`/" +"usr/local/bin` 加入Unix終端的搜索路徑,鍵入以下命令就可以啟動Python:" #: ../../tutorial/interpreter.rst:21 msgid "" "to the shell. [#]_ Since the choice of the directory where the interpreter " "lives is an installation option, other places are possible; check with your " -"local Python guru or system administrator. (E.g., :file:`/usr/local/python`" -" is a popular alternative location.)" +"local Python guru or system administrator. (E.g., :file:`/usr/local/python` " +"is a popular alternative location.)" msgstr "" -"这样,就可以在 shell 中运行 Python 了 [#]_ 。因为可以选择安装目录,解释器也有可能安装在别的位置;如果还不明白,就去问问身边的 " -"Python 大神或系统管理员。(例如,常见备选路径还有 :file:`/usr/local/python`。)" +"能啟動 Python [#]_\\ 。因為直譯器存放的目錄是個安裝選項,其他的目錄也是有可能" +"的;請洽談在地的 Python 達人或者系統管理員。(例如:\\ :file:`/usr/local/" +"python` 是個很常見的另類存放路徑。)" #: ../../tutorial/interpreter.rst:26 msgid "" -"On Windows machines where you have installed Python from the :ref:`Microsoft" -" Store `, the :file:`python3.9` command will be available. If" -" you have the :ref:`py.exe launcher ` installed, you can use the " -":file:`py` command. See :ref:`setting-envvars` for other ways to launch " +"On Windows machines where you have installed Python from the :ref:`Microsoft " +"Store `, the :file:`python3.9` command will be available. If " +"you have the :ref:`py.exe launcher ` installed, you can use the :" +"file:`py` command. See :ref:`setting-envvars` for other ways to launch " "Python." msgstr "" -"Windows 系统中,从 :ref:`Microsoft Store ` 安装 Python 后,就可以使用 " -":file:`python3.9` 命令了。 如果安装了 :ref:`py.exe 启动器 `,则可以使用 :file:`py` " -"命令。 请参阅 :ref:`setting-envvars`,了解其他启动 Python 的方式。" +"Windows系統中,從 :ref:`Microsoft Store ` 安裝Python後,就可以" +"使用 :file:`python3.9` 命令了。如果安裝了 :ref:`py.exe launcher " +"` ,則可以使用 :file:`py` 命令。請參閱附錄: :ref:`setting-" +"envvars` ,了解其他啟動Python的方式。" #: ../../tutorial/interpreter.rst:31 msgid "" "Typing an end-of-file character (:kbd:`Control-D` on Unix, :kbd:`Control-Z` " -"on Windows) at the primary prompt causes the interpreter to exit with a zero" -" exit status. If that doesn't work, you can exit the interpreter by typing " +"on Windows) at the primary prompt causes the interpreter to exit with a zero " +"exit status. If that doesn't work, you can exit the interpreter by typing " "the following command: ``quit()``." msgstr "" -"在主提示符中,输入文件结束符(Unix 里是 :kbd:`Control-D`,Windows 里是 " -":kbd:`Control-Z`),就会退出解释器,退出状态码为 0。如果不能退出,还可以输入这个命令:``quit()``。" +"在主提示符輸入一個 end-of-file 字元(在 Unix 上為 :kbd:`Control-D`\\ ;在 " +"Windows 上為 :kbd:`Control-Z`\\ )會使得直譯器以零退出狀況 (zero exit " +"status) 離開。如果上述的做法沒有效,也可以輸入指令 ``quit()`` 離開直譯器。" #: ../../tutorial/interpreter.rst:36 msgid "" -"The interpreter's line-editing features include interactive editing, history" -" substitution and code completion on systems that support the `GNU Readline " +"The interpreter's line-editing features include interactive editing, history " +"substitution and code completion on systems that support the `GNU Readline " "`_ library. Perhaps " "the quickest check to see whether command line editing is supported is " "typing :kbd:`Control-P` to the first Python prompt you get. If it beeps, " @@ -86,10 +90,12 @@ msgid "" "echoed, command line editing isn't available; you'll only be able to use " "backspace to remove characters from the current line." msgstr "" -"在支持 `GNU Readline `_ " -"库的系统中,解释器的行编辑功能包括交互式编辑、历史替换、代码补全等。检测是否支持命令行编辑最快速的方式是,在首次出现 Python 提示符时,输入 " -":kbd:`Control-P`。听到“哔”提示音,说明支持行编辑;请参阅附录 :ref:`tut-" -"interacting`,了解功能键。如果没有反应,或回显了 ``^P``,则说明不支持行编辑;只能用退格键删除当前行的字符。" +"直譯器的指令列編輯功能有很多,在支援 `GNU Readline ` 函式庫的系統上包含:互動編輯、歷史取代、指令補" +"完等功能。最快檢查有無支援指令列編輯的方法為:在第一個 Python 提示符後輸入 :" +"kbd:`Control-P` ,如果出現嗶嗶聲,就代表有支援;見附錄 :ref:`tut-" +"interacting` 介紹相關的快速鍵。如果什麼事沒有發生,或者出現一個 ``^P`` ,就代" +"表並沒有指令列編輯功能;此時只能使用 backspace 去除該行的字元。" #: ../../tutorial/interpreter.rst:46 msgid "" @@ -98,20 +104,21 @@ msgid "" "interactively; when called with a file name argument or with a file as " "standard input, it reads and executes a *script* from that file." msgstr "" -"解释器的操作方式类似 Unix Shell:用与 tty " -"设备关联的标准输入调用时,可以交互式地读取和执行命令;以文件名参数,或标准输入文件调用时,则读取并执行文件中的 *脚本*。" +"這個直譯器使用起來像是 Unix shell:如果它被呼叫時連結至一個 tty 裝置,它會互" +"動式地讀取並執行指令;如果被呼叫時給定檔名為引數或者使用 stdin 傳入檔案內容," +"它會將這個檔案視為\\ **腳本**\\ 來閱讀。" #: ../../tutorial/interpreter.rst:51 msgid "" -"A second way of starting the interpreter is ``python -c command [arg] ...``," -" which executes the statement(s) in *command*, analogous to the shell's " -":option:`-c` option. Since Python statements often contain spaces or other " +"A second way of starting the interpreter is ``python -c command [arg] ...``, " +"which executes the statement(s) in *command*, analogous to the shell's :" +"option:`-c` option. Since Python statements often contain spaces or other " "characters that are special to the shell, it is usually advised to quote " "*command* in its entirety with single quotes." msgstr "" -"启动解释器的另一种方式是 ``python -c command [arg] ...``,这与 shell 的 :option:`-c` " -"选项类似,其中,*command* 需换成要执行的语句。由于 Python 语句经常包含空格等被 shell " -"特殊对待的字符,一般情况下,建议用单引号标注整个 *command*。" +"另一個啟動直譯器的方式為 ``python -c command [arg] ...`` ,它會執行在 " +"*command* 裡的指令(們),行為如同 shell 的 :option:`-c` 選項。因為 Python 的" +"指令包含空白等 shell 用到的特殊字元,通常建議用單引號把 *command* 包起來。" #: ../../tutorial/interpreter.rst:57 msgid "" @@ -119,23 +126,25 @@ msgid "" "``python -m module [arg] ...``, which executes the source file for *module* " "as if you had spelled out its full name on the command line." msgstr "" -"Python 模块也可以当作脚本使用。输入:``python -m module [arg] ...``,会执行 *module* " -"的源文件,这跟在命令行把路径写全了一样。" +"有些 Python 模組使用上如腳本般一樣方便。透過 ``python -m module [arg] ...`` " +"可以執行 *module* 模組的原始碼,就如同直接傳入那個模組的完整路徑一樣的行為。" #: ../../tutorial/interpreter.rst:61 msgid "" "When a script file is used, it is sometimes useful to be able to run the " -"script and enter interactive mode afterwards. This can be done by passing " -":option:`-i` before the script." -msgstr "在交互模式下运行脚本文件,只要在脚本名称参数前,加上选项 :option:`-i` 就可以了。" +"script and enter interactive mode afterwards. This can be done by passing :" +"option:`-i` before the script." +msgstr "" +"當要執行一個腳本檔時,有時候會希望在腳本結束時進入互動模式。此時可在執行腳本" +"的指令加入 :option:`-i` 。" #: ../../tutorial/interpreter.rst:65 msgid "All command line options are described in :ref:`using-on-general`." -msgstr "命令行的所有选项详见 :ref:`using-on-general`。" +msgstr "所有指令可用的參數都詳記在 :ref:`using-on-general` 。" #: ../../tutorial/interpreter.rst:71 msgid "Argument Passing" -msgstr "传入参数" +msgstr "傳遞引數" #: ../../tutorial/interpreter.rst:73 msgid "" @@ -143,25 +152,27 @@ msgid "" "thereafter are turned into a list of strings and assigned to the ``argv`` " "variable in the ``sys`` module. You can access this list by executing " "``import sys``. The length of the list is at least one; when no script and " -"no arguments are given, ``sys.argv[0]`` is an empty string. When the script" -" name is given as ``'-'`` (meaning standard input), ``sys.argv[0]`` is set " +"no arguments are given, ``sys.argv[0]`` is an empty string. When the script " +"name is given as ``'-'`` (meaning standard input), ``sys.argv[0]`` is set " "to ``'-'``. When :option:`-c` *command* is used, ``sys.argv[0]`` is set to " "``'-c'``. When :option:`-m` *module* is used, ``sys.argv[0]`` is set to " "the full name of the located module. Options found after :option:`-c` " "*command* or :option:`-m` *module* are not consumed by the Python " -"interpreter's option processing but left in ``sys.argv`` for the command or" -" module to handle." +"interpreter's option processing but left in ``sys.argv`` for the command or " +"module to handle." msgstr "" -"解释器读取命令行参数,把脚本名与其他参数转化为字符串列表存到 ``sys`` 模块的 ``argv`` 变量里。执行 ``import " -"sys``,可以导入这个模块,并访问该列表。该列表最少有一个元素;未给定输入参数时,``sys.argv[0]`` 是空字符串。给定脚本名是 " -"``'-'`` (标准输入)时,``sys.argv[0]`` 是 ``'-'``。使用 :option:`-c` *command* " -"时,``sys.argv[0]`` 是 ``'-c'``。如果使用选项 :option:`-m` *module*,``sys.argv[0]`` " -"就是包含目录的模块全名。解释器不处理 :option:`-c` *command* 或 :option:`-m` *module* " -"之后的选项,而是直接留在 ``sys.argv`` 中由命令或模块来处理。" +"當直擇器收到腳本的名稱和額外的引數後,他們會轉換為由字串所組成的 list(串列)" +"並指派給 ``sys`` 模組的 ``argv`` 變數。你可以執行 ``import sys`` 取得這個串" +"列。這個串列的長度至少為一;當沒有給任何腳本名稱和引數時, ``sys.argv[0]`` 為" +"空字串。當腳本名為 ``'-'`` (指標準輸入)時, ``sys.argv[0]`` 為 ``'-'`` 。當" +"使用 :option:`-c` *command* 時, ``sys.argv[0]`` 為 ``'-c'``\\ 。當使用 :" +"option:`-m` *module* 時, ``sys.argv[0]`` 為該模組存在的完整路徑。其餘非 :" +"option:`-c` *command* 或 :option:`-m` *module* 的選項不會被 Python 直譯器吸收" +"掉,而是留在 ``sys.argv`` 變數中給後續的 command 或 module 使用。" #: ../../tutorial/interpreter.rst:89 msgid "Interactive Mode" -msgstr "交互模式" +msgstr "互動模式" #: ../../tutorial/interpreter.rst:91 msgid "" @@ -169,74 +180,91 @@ msgid "" "*interactive mode*. In this mode it prompts for the next command with the " "*primary prompt*, usually three greater-than signs (``>>>``); for " "continuation lines it prompts with the *secondary prompt*, by default three " -"dots (``...``). The interpreter prints a welcome message stating its version" -" number and a copyright notice before printing the first prompt:" +"dots (``...``). The interpreter prints a welcome message stating its version " +"number and a copyright notice before printing the first prompt:" msgstr "" -"在终端(tty)输入并执行指令时,解释器在 *交互模式(interactive mode)* 中运行。在这种模式中,会显示 " -"*主提示符*,提示输入下一条指令,主提示符通常用三个大于号(``>>>``)表示;输入连续行时,显示 " -"*次要提示符*,默认是三个点(``...``)。进入解释器时,首先显示欢迎信息、版本信息、版权声明,然后才是提示符:" +"在終端(tty)輸入並執行指令時,解釋器在*互動模式(interactive mode)*中運行。" +"在這種模式中,會顯示*主提示符*,提示輸入下一條指令,主提示符通常用三個大於號" +"(``>>>``)表示;輸入連續行時,顯示*次要提示符*,預設是三個點(``...``)。進" +"入解釋器時,首先顯示歡迎信息、版本信息、版權聲明,然後才是提示符:\n" +"\n" +"::" #: ../../tutorial/interpreter.rst:108 msgid "" "Continuation lines are needed when entering a multi-line construct. As an " "example, take a look at this :keyword:`if` statement::" -msgstr "输入多行架构的语句时,要用连续行。以 :keyword:`if` 为例:" +msgstr "" +"接續多行的情況出現在需要多行才能建立完整指令時。舉例來說,像是 :keyword:`if` " +"敘述:\n" +"\n" +"::" #: ../../tutorial/interpreter.rst:118 msgid "For more on interactive mode, see :ref:`tut-interac`." -msgstr "交互模式的内容详见 :ref:`tut-interac`。" +msgstr "更多有關互動模式的使用,請見\\ :ref:`tut-interac`\\ 。" #: ../../tutorial/interpreter.rst:124 msgid "The Interpreter and Its Environment" -msgstr "解释器的运行环境" +msgstr "直譯器與它的環境" #: ../../tutorial/interpreter.rst:130 msgid "Source Code Encoding" -msgstr "源文件的字符编码" +msgstr "原始碼的字元編碼 (encoding)" #: ../../tutorial/interpreter.rst:132 msgid "" "By default, Python source files are treated as encoded in UTF-8. In that " "encoding, characters of most languages in the world can be used " -"simultaneously in string literals, identifiers and comments --- although the" -" standard library only uses ASCII characters for identifiers, a convention " +"simultaneously in string literals, identifiers and comments --- although the " +"standard library only uses ASCII characters for identifiers, a convention " "that any portable code should follow. To display all these characters " -"properly, your editor must recognize that the file is UTF-8, and it must use" -" a font that supports all the characters in the file." +"properly, your editor must recognize that the file is UTF-8, and it must use " +"a font that supports all the characters in the file." msgstr "" -"默认情况下,Python 源码文件的编码是 UTF-8。这种编码支持世界上大多数语言的字符,可以用于字符串字面值、变量、函数名及注释 —— " -"尽管标准库只用常规的 ASCII 字符作为变量名或函数名,可移植代码都应遵守此约定。要正确显示这些字符,编辑器必须能识别 UTF-8 " -"编码,而且必须使用支持文件中所有字符的字体。" +"預設 Python 原始碼檔案的字元編碼使用 UTF-8。在這個編碼中,世界上多數語言的文" +"字可以同時被使用在字串內容、識別名 (identifier) 及註解中 --- 雖然在標準函式庫" +"中只使用 ASCII 字元作為識別名,這也是個任何 portable 程式碼需遵守的慣例。如果" +"要正確地顯示所有字元,您的編輯器需要能夠認識檔案為 UTF-8,並且需要能顯示檔案" +"中所有字元的字型。" #: ../../tutorial/interpreter.rst:140 msgid "" "To declare an encoding other than the default one, a special comment line " "should be added as the *first* line of the file. The syntax is as follows::" -msgstr "如果不使用默认编码,则要声明文件的编码,文件的 *第一* 行要写成特殊注释。句法如下:" +msgstr "" +"如果不使用預設編碼,則要聲明文件的編碼,文件的*第一*行要寫成特殊註釋。句法如" +"下:\n" +"\n" +"::" #: ../../tutorial/interpreter.rst:145 -msgid "" -"where *encoding* is one of the valid :mod:`codecs` supported by Python." -msgstr "其中,*encoding* 可以是 Python 支持的任意一种 :mod:`codecs`。" +msgid "where *encoding* is one of the valid :mod:`codecs` supported by Python." +msgstr "其中, *encoding* 可以是Python支持的任意一種 :mod:`codecs` 。" #: ../../tutorial/interpreter.rst:147 msgid "" "For example, to declare that Windows-1252 encoding is to be used, the first " "line of your source code file should be::" -msgstr "比如,声明使用 Windows-1252 编码,源码文件要写成:" +msgstr "" +"比如,聲明使用Windows-1252 編碼,源碼文件要寫成:\n" +"\n" +"::" #: ../../tutorial/interpreter.rst:152 msgid "" -"One exception to the *first line* rule is when the source code starts with a" -" :ref:`UNIX \"shebang\" line `. In this case, the encoding " +"One exception to the *first line* rule is when the source code starts with " +"a :ref:`UNIX \"shebang\" line `. In this case, the encoding " "declaration should be added as the second line of the file. For example::" msgstr "" -"*第一行* 的规则也有一种例外情况,源码以 :ref:`UNIX \"shebang\" 行 ` " -"开头。此时,编码声明要写在文件的第二行。例如:" +"*第一行*的規則也有一種例外情況,在源碼以 :ref:`UNIX \"shebang\" line ` 行開頭時。此時,編碼聲明要寫在文件的第二行。例如:\n" +"\n" +"::" #: ../../tutorial/interpreter.rst:160 msgid "Footnotes" -msgstr "脚注" +msgstr "註解" #: ../../tutorial/interpreter.rst:161 msgid "" @@ -244,4 +272,5 @@ msgid "" "executable named ``python``, so that it does not conflict with a " "simultaneously installed Python 2.x executable." msgstr "" -"Unix 系统中,为了不与同时安装的 Python 2.x 冲突,Python 3.x 解释器默认安装的执行文件名不是 ``python``。" +"在 Unix 中,Python 3.x 直譯器預設安裝不會以 ``python`` 作為執行檔名稱,以避免" +"與 現有的 Python 2.x 執行檔名稱衝突。" diff --git a/tutorial/introduction.po b/tutorial/introduction.po index a80d8d2b8..33a0fa8ab 100644 --- a/tutorial/introduction.po +++ b/tutorial/introduction.po @@ -1,8 +1,7 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2021, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. -# +# # Translators: # 张俊(fighting) , 2017 # Jerry Chen , 2017 @@ -10,69 +9,81 @@ # QR Wang , 2018 # Fred , 2018 # jaystone776 <1732865113@qq.com>, 2021 -# -#, fuzzy +# Ching-Hao Liu , 2018 +# Liang-Bo Wang , 2016 +# Steven Hsu , 2021 msgid "" msgstr "" "Project-Id-Version: Python 3.9\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-01-01 05:02+0000\n" -"PO-Revision-Date: 2017-02-16 23:41+0000\n" -"Last-Translator: jaystone776 <1732865113@qq.com>, 2021\n" -"Language-Team: Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n" +"POT-Creation-Date: 2020-06-20 18:08+0800\n" +"PO-Revision-Date: 2021-04-29 05:07+0800\n" +"Last-Translator: # Steven Hsu \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: zh_CN\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 2.4.3\n" #: ../../tutorial/introduction.rst:5 msgid "An Informal Introduction to Python" -msgstr "Python 速览" +msgstr "一個非正式的 Python 簡介" #: ../../tutorial/introduction.rst:7 msgid "" "In the following examples, input and output are distinguished by the " "presence or absence of prompts (:term:`>>>` and :term:`...`): to repeat the " -"example, you must type everything after the prompt, when the prompt appears;" -" lines that do not begin with a prompt are output from the interpreter. Note" -" that a secondary prompt on a line by itself in an example means you must " +"example, you must type everything after the prompt, when the prompt appears; " +"lines that do not begin with a prompt are output from the interpreter. Note " +"that a secondary prompt on a line by itself in an example means you must " "type a blank line; this is used to end a multi-line command." msgstr "" -"下面的例子以是否显示提示符(:term:`>>>` 与 " -":term:`...`)区分输入与输出:输入例子中的代码时,要键入以提示符开头的行中提示符后的所有内容;未以提示符开头的行是解释器的输出。注意,例子中的某行出现的第二个提示符是用来结束多行命令的,此时,要键入一个空白行。" +"在下面的例子中,輸入與輸出的區別在於有無提示符(prompt,\\ :term:`>>>` 和 :" +"term:`...`\\ ):如果要重做範例,你必須在提示符出現的時候,輸入提示符後方的所" +"有內容;那些非提示符開始的文字行是直譯器的輸出。注意到在範例中,若出現單行只" +"有次提示符時,代表該行你必須直接換行;這被使用在多行指令結束輸入時。" #: ../../tutorial/introduction.rst:16 msgid "" "Many of the examples in this manual, even those entered at the interactive " -"prompt, include comments. Comments in Python start with the hash character," -" ``#``, and extend to the end of the physical line. A comment may appear at" -" the start of a line or following whitespace or code, but not within a " -"string literal. A hash character within a string literal is just a hash " -"character. Since comments are to clarify code and are not interpreted by " -"Python, they may be omitted when typing in examples." +"prompt, include comments. Comments in Python start with the hash character, " +"``#``, and extend to the end of the physical line. A comment may appear at " +"the start of a line or following whitespace or code, but not within a string " +"literal. A hash character within a string literal is just a hash character. " +"Since comments are to clarify code and are not interpreted by Python, they " +"may be omitted when typing in examples." msgstr "" -"本手册中的许多例子,甚至交互式命令都包含注释。Python 注释以 ``#`` " -"开头,直到该物理行结束。注释可以在行开头,或空白符与代码之后,但不能在字符串里面。字符串中的井号就是井号。注释用于阐明代码,Python " -"不解释注释,键入例子时,可以不输入注释。" +"在本手冊中的許多範例中,即便他們為互動式地輸入,仍然包含註解。Python 中的註" +"解 (comments) 由 hash 字元 ``#`` 開始一直到該行結束。註解可以從該行之首、空白" +"後、或程式碼之後開始,但不會出現在字串之中。hash 字元在字串之中時仍視為一 " +"hash 字元。因為註解只是用來說明程式而不會被 Python 解讀,在練習範例時不一定要" +"輸入。" #: ../../tutorial/introduction.rst:24 msgid "Some examples::" -msgstr "几个例子:" +msgstr "" +"一些範例如下:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:35 msgid "Using Python as a Calculator" -msgstr "Python 用作计算器" +msgstr "把 Python 當作計算機使用" #: ../../tutorial/introduction.rst:37 msgid "" "Let's try some simple Python commands. Start the interpreter and wait for " "the primary prompt, ``>>>``. (It shouldn't take long.)" -msgstr "现在,尝试一些简单的 Python 命令。启动解释器,等待主提示符(``>>>`` )出现。" +msgstr "" +"讓我們來試試一些簡單的 Python 指令。啟動直譯器並等待第一個主提示符 ``>>>`` 出" +"現。(應該不會等太久)" #: ../../tutorial/introduction.rst:44 msgid "Numbers" -msgstr "数字" +msgstr "數字 (Number)" #: ../../tutorial/introduction.rst:46 msgid "" @@ -82,80 +93,109 @@ msgid "" "languages (for example, Pascal or C); parentheses (``()``) can be used for " "grouping. For example::" msgstr "" -"解释器像一个简单的计算器:输入表达式,就会给出答案。表达式的语法很直接:运算符 ``+``、``-``、``*``、``/`` " -"的用法和其他大部分语言一样(比如,Pascal 或 C);括号 (``()``) 用来分组。例如:" +"直譯器如同一台簡單的計算機:你可以輸入一個 expression(運算式),它會寫出該式" +"的值。Expression 的語法很使用:運算子 ``+``、``-``、``*`` 和 ``/`` 的行為如同" +"大多數的程式語言(例如:Pascal 或 C);括號 ``()`` 可以用來分群。例如:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:61 msgid "" "The integer numbers (e.g. ``2``, ``4``, ``20``) have type :class:`int`, the " -"ones with a fractional part (e.g. ``5.0``, ``1.6``) have type " -":class:`float`. We will see more about numeric types later in the tutorial." +"ones with a fractional part (e.g. ``5.0``, ``1.6``) have type :class:" +"`float`. We will see more about numeric types later in the tutorial." msgstr "" -"整数(如,``2``、``4``、``20`` )的类型是 :class:`int`,带小数(如,``5.0``、``1.6`` )的类型是 " -":class:`float`。本教程后半部分将介绍更多数字类型。" +"整數數字(即 ``2``、``4``、``20``)為 :class:`int` 型態,數字有小數點部份的" +"(即 ``5.0``、``1.6``)為 :class:`float` 型態。我們將在之後的教學中看到更多數" +"字相關的型態。" #: ../../tutorial/introduction.rst:65 msgid "" "Division (``/``) always returns a float. To do :term:`floor division` and " -"get an integer result (discarding any fractional result) you can use the " -"``//`` operator; to calculate the remainder you can use ``%``::" +"get an integer result (discarding any fractional result) you can use the ``//" +"`` operator; to calculate the remainder you can use ``%``::" msgstr "" -"除法运算(``/``)返回浮点数。用 ``//`` 运算符执行 :term:`floor division` 的结果是整数(忽略小数);计算余数用 " -"``%``:" +"除法 (``/``) 永遠回傳一個 float。如果要做 :term:`floor division` 並拿到整數的" +"結果(即去除所有小數點的部份),你可以使用 ``//`` 運算子;計算餘數可以使用 ``" +"%``:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:79 msgid "" "With Python, it is possible to use the ``**`` operator to calculate powers " "[#]_::" -msgstr "Python 用 ``**`` 运算符计算乘方 [#]_:" +msgstr "" +"在 Python 中,計算冪次 (powers) 可以使用 ``**`` 運算子 [#]_:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:86 msgid "" "The equal sign (``=``) is used to assign a value to a variable. Afterwards, " "no result is displayed before the next interactive prompt::" -msgstr "等号(``=``)用于给变量赋值。赋值后,下一个交互提示符的位置不显示任何结果:" +msgstr "" +"等於符號 (``=``) 可以用於為變數賦值。賦值完之後,在下個指示符前並不會顯示任何" +"結果:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:94 msgid "" "If a variable is not \"defined\" (assigned a value), trying to use it will " "give you an error::" -msgstr "如果变量未定义(即,未赋值),使用该变量会提示错误:" +msgstr "" +"如果一個變數未被「定義 (defined)」(即變數未被賦值),試著使用它時會出現一個" +"錯誤:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:102 msgid "" -"There is full support for floating point; operators with mixed type operands" -" convert the integer operand to floating point::" -msgstr "Python 全面支持浮点数;混合类型运算数的运算会把整数转换为浮点数:" +"There is full support for floating point; operators with mixed type operands " +"convert the integer operand to floating point::" +msgstr "" +"浮點數的運算有完善的支援,運算子 (operator) 遇上混合的運算元 (operand) 時會把" +"整數的運算元轉換為浮點數:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:108 msgid "" -"In interactive mode, the last printed expression is assigned to the variable" -" ``_``. This means that when you are using Python as a desk calculator, it " +"In interactive mode, the last printed expression is assigned to the variable " +"``_``. This means that when you are using Python as a desk calculator, it " "is somewhat easier to continue calculations, for example::" -msgstr "交互模式下,上次输出的表达式会赋给变量 ``_``。把 Python 当作计算器时,用该变量实现下一步计算更简单,例如:" +msgstr "" +"在互動式模式中,最後一個印出的運算式的結果會被指派至變數 ``_`` 中。這表示當你" +"把 Python 當作桌上計算機使用者,要接續計算變得容易許多:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:121 msgid "" "This variable should be treated as read-only by the user. Don't explicitly " -"assign a value to it --- you would create an independent local variable with" -" the same name masking the built-in variable with its magic behavior." -msgstr "最好把该变量当作只读类型。不要为它显式赋值,否则会创建一个同名独立局部变量,该变量会用它的魔法行为屏蔽内置变量。" +"assign a value to it --- you would create an independent local variable with " +"the same name masking the built-in variable with its magic behavior." +msgstr "" +"這個變數應該被使用者視為只能讀取。不應該明確地為它賦值 --- 你可以創一個獨立但" +"名稱相同的本地變數來覆蓋掉預設變數和它的神奇行為。" #: ../../tutorial/introduction.rst:125 msgid "" "In addition to :class:`int` and :class:`float`, Python supports other types " -"of numbers, such as :class:`~decimal.Decimal` and " -":class:`~fractions.Fraction`. Python also has built-in support for " -":ref:`complex numbers `, and uses the ``j`` or ``J`` suffix to" -" indicate the imaginary part (e.g. ``3+5j``)." +"of numbers, such as :class:`~decimal.Decimal` and :class:`~fractions." +"Fraction`. Python also has built-in support for :ref:`complex numbers " +"`, and uses the ``j`` or ``J`` suffix to indicate the " +"imaginary part (e.g. ``3+5j``)." msgstr "" -"除了 :class:`int` 和 :class:`float`,Python 还支持其他数字类型,例如 " -":class:`~decimal.Decimal` 或 :class:`~fractions.Fraction`。Python 还内置支持 " -":ref:`复数 `,后缀 ``j`` 或 ``J`` 用于表示虚数(例如 ``3+5j`` )。" +"除了 :class:`int` 和 :class:`float`,Python 還支援了其他的數字型態,包含 :" +"class:`~decimal.Decimal` 和 :class:`~fractions.Fraction`。Python 亦內建支援" +"\\ :ref:`複數 (complex numbers) `,並使用 ``j`` 和 ``J`` 後綴來" +"指定虛數的部份(即 ``3+5j``)。" #: ../../tutorial/introduction.rst:135 msgid "Strings" -msgstr "字符串" +msgstr "字串 (String)" #: ../../tutorial/introduction.rst:137 msgid "" @@ -164,109 +204,157 @@ msgid "" "double quotes (``\"...\"``) with the same result [#]_. ``\\`` can be used " "to escape quotes::" msgstr "" -"除了数字,Python 还可以操作字符串。字符串有多种表现形式,用单引号(``'……'``)或双引号(``\"……\"``)标注的结果相同 " -"[#]_。反斜杠 ``\\`` 用于转义:" +"除了數字之外,Python 也可以操作字串,而表達字串有數種方式。它們可以用包含在單" +"引號 (``'...'``) 或雙引號 (``\"...\"``) 之中,兩者會得到相同的結果\\ [#]_" +"\\ 。使用 ``\\`` 跳脫出現於字串中的引號:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:155 msgid "" "In the interactive interpreter, the output string is enclosed in quotes and " -"special characters are escaped with backslashes. While this might sometimes" -" look different from the input (the enclosing quotes could change), the two " +"special characters are escaped with backslashes. While this might sometimes " +"look different from the input (the enclosing quotes could change), the two " "strings are equivalent. The string is enclosed in double quotes if the " "string contains a single quote and no double quotes, otherwise it is " "enclosed in single quotes. The :func:`print` function produces a more " "readable output, by omitting the enclosing quotes and by printing escaped " "and special characters::" msgstr "" -"交互式解释器会为输出的字符串加注引号,特殊字符使用反斜杠转义。虽然,有时输出的字符串看起来与输入的字符串不一样(外加的引号可能会改变),但两个字符串是相同的。如果字符串中有单引号而没有双引号,该字符串外将加注双引号,反之,则加注单引号。:func:`print`" -" 函数输出的内容更简洁易读,它会省略两边的引号,并输出转义后的特殊字符:" +"在互動式的直譯器中,輸出的字串會被引號包圍且特殊符號會使用反斜線 (``\\``) 跳" +"脫。雖然這有時會讓它看起來跟輸入的字串不相同(包圍用的引號可能會改變),輸入" +"和輸出兩字串實為相同。一般來說,字串包含單引號而沒有雙引號時,會使用雙引號包" +"圍字串。函式 :func:`print` 會產生更易讀的輸出,它會去除掉包圍的引號,並且直接" +"印出被跳脫的字元和特殊字元:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:175 msgid "" -"If you don't want characters prefaced by ``\\`` to be interpreted as special" -" characters, you can use *raw strings* by adding an ``r`` before the first " +"If you don't want characters prefaced by ``\\`` to be interpreted as special " +"characters, you can use *raw strings* by adding an ``r`` before the first " "quote::" -msgstr "如果不希望前置 ``\\`` 的字符转义成特殊字符,可以使用 *原始字符串*,在引号前添加 ``r`` 即可:" +msgstr "" +"如果你不希望字元前出現 ``\\`` 就被當成特殊字元時,可以改使用 *raw string*,在" +"第一個包圍引號前加上 ``r`` :\n" +"\n" +"::" #: ../../tutorial/introduction.rst:185 msgid "" -"String literals can span multiple lines. One way is using triple-quotes: " -"``\"\"\"...\"\"\"`` or ``'''...'''``. End of lines are automatically " -"included in the string, but it's possible to prevent this by adding a ``\\``" -" at the end of the line. The following example::" +"String literals can span multiple lines. One way is using triple-quotes: ``" +"\"\"\"...\"\"\"`` or ``'''...'''``. End of lines are automatically included " +"in the string, but it's possible to prevent this by adding a ``\\`` at the " +"end of the line. The following example::" msgstr "" -"字符串字面值可以实现跨行连续输入。实现方式是用三引号:``\"\"\"...\"\"\"`` 或 " -"``'''...'''``,字符串行尾会自动加上回车换行,如果不需要回车换行,在行尾添加 ``\\`` 即可。示例如下:" +"字串值可以跨越數行。其中一方式是使用三個重覆引號:\\ ``\"\"\"...\"\"\"`` 或 " +"``'''...'''``\\ 。此時換行會被自動加入字串值中,但也可以在換行前加入 ``\\`` " +"來取消這個行為。在以下的例子中:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:196 msgid "" "produces the following output (note that the initial newline is not " "included):" -msgstr "输出如下(注意,第一行没有换行):" +msgstr "會產生以下的輸出(注意第一個換行並沒有被包含進字串值中):" #: ../../tutorial/introduction.rst:204 msgid "" "Strings can be concatenated (glued together) with the ``+`` operator, and " "repeated with ``*``::" -msgstr "字符串可以用 ``+`` 合并(粘到一起),也可以用 ``*`` 重复:" +msgstr "" +"字串可以使用 ``+`` 運算子連接 (concatenate),並用 ``*`` 重覆該字串的內容:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:211 msgid "" "Two or more *string literals* (i.e. the ones enclosed between quotes) next " "to each other are automatically concatenated. ::" -msgstr "相邻的两个或多个 *字符串字面值* (引号标注的字符)会自动合并:" +msgstr "" +"兩個以上相鄰的字串值(*string literal*,即被引號包圍的字串)會被自動連接起" +"來:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:217 msgid "" "This feature is particularly useful when you want to break long strings::" -msgstr "拆分长字符串时,这个功能特别实用:" +msgstr "" +"當你想要分段一個非常長的字串時,兩相鄰字串值自動連接的特性十分有用:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:224 msgid "" -"This only works with two literals though, not with variables or " -"expressions::" -msgstr "这项功能只能用于两个字面值,不能用于变量或表达式:" +"This only works with two literals though, not with variables or expressions::" +msgstr "" +"但這特性只限於兩相鄰的字串值間,而非兩相鄰變數或表達式:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:238 msgid "" -"If you want to concatenate variables or a variable and a literal, use " -"``+``::" -msgstr "合并多个变量,或合并变量与字面值,要用 ``+``:" +"If you want to concatenate variables or a variable and a literal, use ``+``::" +msgstr "" +"如果要連接變數們或一個變數與一個字串值,使用 ``+``:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:243 msgid "" "Strings can be *indexed* (subscripted), with the first character having " -"index 0. There is no separate character type; a character is simply a string" -" of size one::" -msgstr "字符串支持 *索引* (下标访问),第一个字符的索引是 0。单字符没有专用的类型,就是长度为一的字符串:" +"index 0. There is no separate character type; a character is simply a string " +"of size one::" +msgstr "" +"字串可以被「索引 *indexed*」(下標,即 subscripted),第一個字元的索引值為 0。" +"沒有獨立表示字元的型別;一個字元就是一個大小為 1 的字串:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:253 msgid "" "Indices may also be negative numbers, to start counting from the right::" -msgstr "索引还支持负数,用负数索引时,从右边开始计数:" +msgstr "" +"索引值可以是負的,此時改成從右開始計數:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:262 msgid "Note that since -0 is the same as 0, negative indices start from -1." -msgstr "注意,-0 和 0 一样,因此,负数索引从 -1 开始。" +msgstr "注意到因為 -0 等同於 0,負的索引值由 -1 開始。" #: ../../tutorial/introduction.rst:264 msgid "" "In addition to indexing, *slicing* is also supported. While indexing is " "used to obtain individual characters, *slicing* allows you to obtain " "substring::" -msgstr "除了索引,字符串还支持 *切片*。索引可以提取单个字符,*切片* 则提取子字符串:" +msgstr "" +"除了索引外,字串亦支援「切片 *slicing*」。索引用來拿到單獨的字元,而切片則可" +"以讓你拿到子字串 (substring):\n" +"\n" +"::" #: ../../tutorial/introduction.rst:272 msgid "" "Note how the start is always included, and the end always excluded. This " "makes sure that ``s[:i] + s[i:]`` is always equal to ``s``::" -msgstr "注意,输出结果包含切片开始,但不包含切片结束。因此,``s[:i] + s[i:]`` 总是等于 ``s``:" +msgstr "" +"注意到起點永遠被包含,而結尾永遠不被包含。這確保了 ``s[:i] + s[i:]`` 永遠等" +"於 ``s``:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:280 msgid "" -"Slice indices have useful defaults; an omitted first index defaults to zero," -" an omitted second index defaults to the size of the string being sliced. ::" -msgstr "切片索引的默认值很有用;省略开始索引时,默认值为 0,省略结束索引时,默认为到字符串的结尾:" +"Slice indices have useful defaults; an omitted first index defaults to zero, " +"an omitted second index defaults to the size of the string being sliced. ::" +msgstr "" +"切片索引 (slice indices) 有很常用的預設值,省略起點索引值時預設為 0,而省略第" +"二個索引值時預設整個字串被包含在 slice 中:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:290 msgid "" @@ -274,47 +362,71 @@ msgid "" "*between* characters, with the left edge of the first character numbered 0. " "Then the right edge of the last character of a string of *n* characters has " "index *n*, for example::" -msgstr "还可以这样理解切片,索引指向的是字符 *之间* ,第一个字符的左侧标为 0,最后一个字符的右侧标为 *n* ,*n* 是字符串长度。例如:" +msgstr "" +"這裡有個簡單記住 slice 是如何運作的方式。想像 slice 的索引值指著字元們之間," +"其中第一個字元的左側邊緣由 0 計數。則 *n* 個字元的字串中最後一個字元的右側邊" +"緣會有索引值 *n*,例如:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:301 msgid "" "The first row of numbers gives the position of the indices 0...6 in the " "string; the second row gives the corresponding negative indices. The slice " -"from *i* to *j* consists of all characters between the edges labeled *i* and" -" *j*, respectively." +"from *i* to *j* consists of all characters between the edges labeled *i* and " +"*j*, respectively." msgstr "" -"第一行数字是字符串中索引 0...6 的位置,第二行数字是对应的负数索引位置。*i* 到 *j* 的切片由 *i* 和 *j* 之间所有对应的字符组成。" +"第一行數字給定字串索引值為 0...6 的位置;第二行則標示了負索引值的位置。由 " +"*i* 至 *j* 的 slice 包含了標示 *i* 和 *j* 邊緣間的所有字元。" #: ../../tutorial/introduction.rst:306 msgid "" "For non-negative indices, the length of a slice is the difference of the " "indices, if both are within bounds. For example, the length of " "``word[1:3]`` is 2." -msgstr "对于使用非负索引的切片,如果两个索引都不越界,切片长度就是起止索引之差。例如, ``word[1:3]`` 的长度是 2。" +msgstr "" +"對非負數的索引值而言,一個 slice 的長度等於其索引值之差,如果索引值落在字串邊" +"界內。例如,``word[1:3]`` 的長度是 2。" #: ../../tutorial/introduction.rst:310 msgid "Attempting to use an index that is too large will result in an error::" -msgstr "索引越界会报错:" +msgstr "" +"嘗試使用一個過大的索引值會造成錯誤:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:317 msgid "" "However, out of range slice indexes are handled gracefully when used for " "slicing::" -msgstr "但是,切片会自动处理越界索引:" +msgstr "" +"然而,超出範圍的索引值在 slice 中會被妥善的處理:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:325 msgid "" "Python strings cannot be changed --- they are :term:`immutable`. Therefore, " "assigning to an indexed position in the string results in an error::" -msgstr "Python 字符串不能修改,是 :term:`immutable` 的。因此,为字符串中某个索引位置赋值会报错:" +msgstr "" +"Python 字串無法被改變 --- 它們是 :term:`immutable`。因此,嘗試對字串中某個索" +"引位置賦值會產生錯誤:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:337 msgid "If you need a different string, you should create a new one::" -msgstr "要生成不同的字符串,应新建一个字符串:" +msgstr "" +"如果你需要一個不一樣的字串,你必須建立一個新的:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:344 msgid "The built-in function :func:`len` returns the length of a string::" -msgstr "内置函数 :func:`len` 返回字符串的长度:" +msgstr "" +"內建的函式 :func:`len` 回傳一個字串的長度:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:355 msgid ":ref:`textseq`" @@ -324,7 +436,7 @@ msgstr ":ref:`textseq`" msgid "" "Strings are examples of *sequence types*, and support the common operations " "supported by such types." -msgstr "字符串是 *序列类型* ,支持序列类型的各种操作。" +msgstr "字串是 *sequence 型別*\\ 的範例之一,並支援該型別常用的操作。" #: ../../tutorial/introduction.rst:359 msgid ":ref:`string-methods`" @@ -334,7 +446,7 @@ msgstr ":ref:`string-methods`" msgid "" "Strings support a large number of methods for basic transformations and " "searching." -msgstr "字符串支持很多变形与查找方法。" +msgstr "字串支援非常多種基本轉換和搜尋的方法。" #: ../../tutorial/introduction.rst:362 msgid ":ref:`f-strings`" @@ -342,7 +454,7 @@ msgstr ":ref:`f-strings`" #: ../../tutorial/introduction.rst:362 msgid "String literals that have embedded expressions." -msgstr "内嵌表达式的字符串字面值。" +msgstr "包含有表示式的字串值。" #: ../../tutorial/introduction.rst:365 msgid ":ref:`formatstrings`" @@ -350,7 +462,7 @@ msgstr ":ref:`formatstrings`" #: ../../tutorial/introduction.rst:365 msgid "Information about string formatting with :meth:`str.format`." -msgstr "使用 :meth:`str.format` 格式化字符串。" +msgstr "關於透過 :meth:`str.format` 字串格式化 (string formatting) 的資訊。" #: ../../tutorial/introduction.rst:368 msgid ":ref:`old-string-formatting`" @@ -360,71 +472,103 @@ msgstr ":ref:`old-string-formatting`" msgid "" "The old formatting operations invoked when strings are the left operand of " "the ``%`` operator are described in more detail here." -msgstr "这里详述了用 ``%`` 运算符格式化字符串的操作。" +msgstr "" +"在字串為 ``%`` 的左運算元時,將觸發舊的字串格式化操作,更多的細節在本連結中介" +"紹。" #: ../../tutorial/introduction.rst:375 msgid "Lists" -msgstr "列表" +msgstr "List(串列)" #: ../../tutorial/introduction.rst:377 msgid "" -"Python knows a number of *compound* data types, used to group together other" -" values. The most versatile is the *list*, which can be written as a list " -"of comma-separated values (items) between square brackets. Lists might " -"contain items of different types, but usually the items all have the same " -"type. ::" +"Python knows a number of *compound* data types, used to group together other " +"values. The most versatile is the *list*, which can be written as a list of " +"comma-separated values (items) between square brackets. Lists might contain " +"items of different types, but usually the items all have the same type. ::" msgstr "" -"Python 支持多种 *复合* 数据类型,可将不同值组合在一起。最常用的 *列表* ,是用方括号标注,逗号分隔的一组值。*列表* " -"可以包含不同类型的元素,但一般情况下,各个元素的类型相同:" +"Python 理解數種複合型資料型別,用來組合不同的數值。當中最多樣變化的型別為 " +"*list*,可以寫成一系列以逗號分隔的數值(稱之元素,即 item),包含在方括號之" +"中。List 可以包合不同型別的元素,但通常這些元素會有相同的型別:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:386 msgid "" "Like strings (and all other built-in :term:`sequence` types), lists can be " "indexed and sliced::" -msgstr "和字符串(及其他内置 :term:`sequence` 类型)一样,列表也支持索引和切片:" +msgstr "" +"如同字串(以及其他內建的 :term:`sequence` 型別),list 可以被索引和切片 " +"(slice):\n" +"\n" +"::" #: ../../tutorial/introduction.rst:396 msgid "" "All slice operations return a new list containing the requested elements. " "This means that the following slice returns a :ref:`shallow copy " "` of the list::" -msgstr "切片操作返回包含请求元素的新列表。以下切片操作会返回列表的 :ref:`浅拷贝 `:" +msgstr "" +"所有切片操作都會回傳一個新的 list ,包含要求的元素。這意謂著以下這個切片回傳" +"了原本 list 的 :ref:`淺複製 ` :\n" +"\n" +"::" #: ../../tutorial/introduction.rst:403 msgid "Lists also support operations like concatenation::" -msgstr "列表还支持合并操作:" +msgstr "" +"List 對支援如接合 (concatenation) 等操作:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:408 msgid "" "Unlike strings, which are :term:`immutable`, lists are a :term:`mutable` " "type, i.e. it is possible to change their content::" -msgstr "与 :term:`immutable` 字符串不同, 列表是 :term:`mutable` 类型,其内容可以改变:" +msgstr "" +"不同於字串是 :term:`immutable`,list 是 :term:`mutable` 型別,即改變 list 的" +"內容是可能的:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:418 msgid "" -"You can also add new items at the end of the list, by using the " -":meth:`~list.append` *method* (we will see more about methods later)::" -msgstr ":meth:`~list.append` *方法* 可以在列表结尾添加新元素(详见后文):" +"You can also add new items at the end of the list, by using the :meth:`~list." +"append` *method* (we will see more about methods later)::" +msgstr "" +"你也可以在 list 的最後加入新元素,透過使用 :meth:`~list.append` *方法* " +"(method)(我們稍後會看到更多方法的說明):\n" +"\n" +"::" #: ../../tutorial/introduction.rst:426 msgid "" "Assignment to slices is also possible, and this can even change the size of " "the list or clear it entirely::" -msgstr "为切片赋值可以改变列表大小,甚至清空整个列表:" +msgstr "" +"也可以對 slice 賦值,這能改變 list 的大小,甚至是清空一個 list:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:445 msgid "The built-in function :func:`len` also applies to lists::" -msgstr "内置函数 :func:`len` 也支持列表:" +msgstr "" +"內建的函式 :func:`len` 亦可以作用在 list 上:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:451 msgid "" "It is possible to nest lists (create lists containing other lists), for " "example::" -msgstr "还可以嵌套列表(创建包含其他列表的列表),例如:" +msgstr "" +"也可以嵌套多層 list (建立 list 包含其他 list),例如:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:467 msgid "First Steps Towards Programming" -msgstr "走向编程的第一步" +msgstr "初探程式設計的前幾步" #: ../../tutorial/introduction.rst:469 msgid "" @@ -433,12 +577,15 @@ msgid "" "`Fibonacci series `_ as " "follows::" msgstr "" -"当然,Python 还可以完成比二加二更复杂的任务。 例如,可以编写 `斐波那契数列 " -"`_ 的初始子序列,如下所示:" +"當然,我們可以用 Python 來處理比 2 加 2 更複雜的工作。例如,我們可以印出\\ `" +"費氏數列 `_\\ 的首幾項序列:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:489 msgid "This example introduces several new features." -msgstr "本例引入了几个新功能。" +msgstr "這例子引入了許多新的特性。" #: ../../tutorial/introduction.rst:491 msgid "" @@ -448,8 +595,9 @@ msgid "" "all evaluated first before any of the assignments take place. The right-" "hand side expressions are evaluated from the left to the right." msgstr "" -"第一行中的 *多重赋值*:变量 ``a`` 和 ``b`` 同时获得新值 0 和 " -"1。最后一行又用了一次多重赋值,这体现在右表达式在赋值前就已经求值了。右表达式求值顺序为从左到右。" +"第一行出現了多重賦值:變數 ``a`` 與 ``b`` 同時得到了新的值 0 與 1。在最後一行" +"同樣的賦值再被使用了一次,示範了等號的右項運算 (expression) 會先被計算 " +"(evaluate),賦值再發生。右項的運算式由左至右依序被計算。" #: ../../tutorial/introduction.rst:497 msgid "" @@ -462,10 +610,13 @@ msgid "" "than), ``>`` (greater than), ``==`` (equal to), ``<=`` (less than or equal " "to), ``>=`` (greater than or equal to) and ``!=`` (not equal to)." msgstr "" -":keyword:`while` 循环只要条件(这里指:``a < 10``)保持为真就会一直执行。Python 和 C " -"一样,任何非零整数都为真,零为假。这个条件也可以是字符串或列表的值,事实上,任何序列都可以;长度非零就为真,空序列则为假。示例中的判断只是最简单的比较。比较操作符的标准写法和" -" C 语言一样: ``<`` (小于)、 ``>`` (大于)、 ``==`` (等于)、 ``<=`` (小于等于)、 ``>=`` (大于等于)及 " -"``!=`` (不等于)。" +":keyword:`while` 迴圈只要它的條件為真(此範例:``a < 10``),將會一直重覆執" +"行。在 Python 中如同 C 語言,任何非零的整數值為真 (true);零為假 (false)。條" +"件可以是字串、list、甚至是任何序列型別;任何非零長度的序列為真,空的序列即為" +"假。本例子使用的條件是個簡單的比較。標準的比較運算子 (comparison operators) " +"使用如同 C 語言一樣的符號:\\ ``<``\\ (小於)、\\ ``>``\\ (大於)、\\ " +"``==``\\ (等於)、\\ ``<=``\\ (小於等於)、\\ ``>=``\\ (大於等於)以及 ``!" +"=``\\ (不等於)。" #: ../../tutorial/introduction.rst:506 msgid "" @@ -478,9 +629,12 @@ msgid "" "(since the parser cannot guess when you have typed the last line). Note " "that each line within a basic block must be indented by the same amount." msgstr "" -"*循环体* 是 *缩进的* :缩进是 Python " -"组织语句的方式。在交互式命令行里,得为每个缩输入制表符或空格。使用文本编辑器可以实现更复杂的输入方式;所有像样的文本编辑器都支持自动缩进。交互式输入复合语句时," -" 要在最后输入空白行表示结束(因为解析器不知道哪一行代码是最后一行)。注意,同一块语句的每一行的缩进相同。" +"迴圈的主體會\\ *縮排*\\ :縮排在 Python 中用來關連一群陳述式。在互動式提示符" +"中,你必須在迴圈內的每一行一開始鍵入 tab 或者(數個)空白來維持縮排。實務上," +"你會先在文字編輯器中準備好比較複雜的輸入;多數編輯器都有自動縮排的功能。當一" +"個複合陳述式以互動地方式輸入,必須在結束時多加一行空行來代表結束(因為語法解" +"析器無法判斷你何時輸入複合陳述的最後一行)。注意在一個縮排段落內的縮排方式與" +"數量必須維持一致。" #: ../../tutorial/introduction.rst:515 msgid "" @@ -491,27 +645,36 @@ msgid "" "without quotes, and a space is inserted between items, so you can format " "things nicely, like this::" msgstr "" -":func:`print` " -"函数输出给定参数的值。与表达式不同(比如,之前计算器的例子),它能处理多个参数,包括浮点数与字符串。它输出的字符串不带引号,且各参数项之间会插入一个空格,这样可以实现更好的格式化操作:" +":func:`print` 函式印出它接收到引數(們)的值。不同於先前僅我們寫下想要的運算" +"(像是先前的計算機範例),它可以處理複數個引數、浮點數數值和字串。印出的字串" +"將不帶有引號,並且不同項目間會插入一個空白,因此可以讓你容易格式化輸出,例" +"如:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:526 msgid "" "The keyword argument *end* can be used to avoid the newline after the " "output, or end the output with a different string::" -msgstr "关键字参数 *end* 可以取消输出后面的换行, 或用另一个字符串结尾:" +msgstr "" +"關鍵字引數 *end* 可以被用來避免額外的換行符加入到輸出中,或者以不同的字串結束" +"輸出:\n" +"\n" +"::" #: ../../tutorial/introduction.rst:538 msgid "Footnotes" -msgstr "脚注" +msgstr "註解" #: ../../tutorial/introduction.rst:539 msgid "" -"Since ``**`` has higher precedence than ``-``, ``-3**2`` will be interpreted" -" as ``-(3**2)`` and thus result in ``-9``. To avoid this and get ``9``, you" -" can use ``(-3)**2``." +"Since ``**`` has higher precedence than ``-``, ``-3**2`` will be interpreted " +"as ``-(3**2)`` and thus result in ``-9``. To avoid this and get ``9``, you " +"can use ``(-3)**2``." msgstr "" -"``**`` 比 ``-`` 的优先级更高, 所以 ``-3**2`` 会被解释成 ``-(3**2)`` ,因此,结果是 " -"``-9``。要避免这个问题,并且得到 ``9``, 可以用 ``(-3)**2``。" +"因為 ``**`` 擁有較 ``-`` 高的優先次序,\\ ``-3**2`` 會被解釋為 ``-(3**2)`` 並" +"得到 ``-9``\\ 。如果要避免這樣的優先順序以得到 ``9``,你可以使用 ``(-3)**2``" +"\\ 。" #: ../../tutorial/introduction.rst:543 msgid "" @@ -520,6 +683,6 @@ msgid "" "only difference between the two is that within single quotes you don't need " "to escape ``\"`` (but you have to escape ``\\'``) and vice versa." msgstr "" -"和其他语言不一样,特殊字符如 ``\\n`` " -"在单引号(``'...'``)和双引号(``\"...\"``)里的意义一样。这两种引号唯一的区别是,不需要在单引号里转义双引号 " -"``\"``,但必须把单引号转义成 ``\\'``,反之亦然。" +"不像其他語言,特殊符號如 ``\\n`` 在單 (``'...'``) 和雙 (``\"...\"``) 引號中有" +"相同的意思。兩種引號的唯一差別,在於使用單引號時,不需要避免 ``\"``\\ (但必" +"須避免 ``\\'``\\ ),反之亦同。"