X Tutup
# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # woodrow-shen , 2015-2016 # Liang-Bo Wang , 2016 # Jason , 2016 # 文俊 高 , 2016 # Adrian Liaw , 2018 # Steven Hsu , 2021 # Phil Lin , 2022 msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-05-21 17:35+0000\n" "PO-Revision-Date: 2022-01-31 18:14+0800\n" "Last-Translator: Phil Lin \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" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Poedit 3.0.1\n" #: ../../tutorial/stdlib.rst:5 msgid "Brief Tour of the Standard Library" msgstr "Python 標準函式庫概覽" #: ../../tutorial/stdlib.rst:11 msgid "Operating System Interface" msgstr "作業系統介面" #: ../../tutorial/stdlib.rst:13 msgid "" "The :mod:`os` module provides dozens of functions for interacting with the " "operating system::" msgstr "" ":mod:`os` 模組提供了數十個與作業系統溝通的函式:\n" "\n" "::" #: ../../tutorial/stdlib.rst:23 msgid "" "Be sure to use the ``import os`` style instead of ``from os import *``. " "This will keep :func:`os.open` from shadowing the built-in :func:`open` " "function which operates much differently." msgstr "" "務必使用 ``import os`` 而非 ``from os import *``。這將避免因系統不同而有實作" "差異的 :func:`os.open` 覆蓋內建函式 :func:`open`\\ 。" #: ../../tutorial/stdlib.rst:29 msgid "" "The built-in :func:`dir` and :func:`help` functions are useful as " "interactive aids for working with large modules like :mod:`os`::" msgstr "" "在使用 :mod:`os` 諸如此類大型模組時搭配內建函式 :func:`dir` 和 :func:`help` " "是非常有用的:\n" "\n" "::" #: ../../tutorial/stdlib.rst:38 msgid "" "For daily file and directory management tasks, the :mod:`shutil` module " "provides a higher level interface that is easier to use::" msgstr "" "對於日常檔案和目錄管理任務,\\ :mod:`shutil` 模組提供了更容易使用的高階介" "面:\n" "\n" "::" #: ../../tutorial/stdlib.rst:51 msgid "File Wildcards" msgstr "檔案之萬用字元 (File Wildcards)" #: ../../tutorial/stdlib.rst:53 msgid "" "The :mod:`glob` module provides a function for making file lists from " "directory wildcard searches::" msgstr "" ":mod:`glob` 模組提供了一函式可以從目錄萬用字元中搜尋並產生檔案列表:\n" "\n" "::" #: ../../tutorial/stdlib.rst:64 msgid "Command Line Arguments" msgstr "命令列引數" #: ../../tutorial/stdlib.rst:66 msgid "" "Common utility scripts often need to process command line arguments. These " "arguments are stored in the :mod:`sys` module's *argv* attribute as a list. " "For instance the following output results from running ``python demo.py one " "two three`` at the command line::" msgstr "" "通用工具腳本常需要處理命令列引數。這些引數會以 list(串列)形式存放在 :mod:" "`sys` 模組的 *argv* 屬性中。例如在命令列執行 ``python demo.py one two " "three`` 會有以下輸出結果:\n" "\n" "::" #: ../../tutorial/stdlib.rst:75 msgid "" "The :mod:`argparse` module provides a more sophisticated mechanism to " "process command line arguments. The following script extracts one or more " "filenames and an optional number of lines to be displayed::" msgstr "" ":mod:`argparse` 模組提供了一種更複雜的機制來處理命令列引數。以下腳本可擷取一" "個或多個檔案名稱,並可選擇要顯示的行數:\n" "\n" "::" #: ../../tutorial/stdlib.rst:89 msgid "" "When run at the command line with ``python top.py --lines=5 alpha.txt beta." "txt``, the script sets ``args.lines`` to ``5`` and ``args.filenames`` to " "``['alpha.txt', 'beta.txt']``." msgstr "" "當 ``python top.py --lines=5 alpha.txt beta.txt`` 在命令列執行時,該腳本會將 " "``args.lines`` 設為 ``5``,並將 ``args.filenames`` 設為 ``['alpha.txt', " "'beta.txt']``。" #: ../../tutorial/stdlib.rst:97 msgid "Error Output Redirection and Program Termination" msgstr "錯誤輸出重新導向與程式終止" #: ../../tutorial/stdlib.rst:99 msgid "" "The :mod:`sys` module also has attributes for *stdin*, *stdout*, and " "*stderr*. The latter is useful for emitting warnings and error messages to " "make them visible even when *stdout* has been redirected::" msgstr "" ":mod:`sys` 模組也有 *stdin*,*stdout*,和 *stderr* 等屬性。即使當 *stdout* 被" "重新導向時,後者 *stderr* 可輸出警告和錯誤訊息:\n" "\n" "::" #: ../../tutorial/stdlib.rst:106 msgid "The most direct way to terminate a script is to use ``sys.exit()``." msgstr "終止腳本最直接的方式就是利用 ``sys.exit()``。" #: ../../tutorial/stdlib.rst:112 msgid "String Pattern Matching" msgstr "字串樣式比對" #: ../../tutorial/stdlib.rst:114 msgid "" "The :mod:`re` module provides regular expression tools for advanced string " "processing. For complex matching and manipulation, regular expressions offer " "succinct, optimized solutions::" msgstr "" ":mod:`re` 模組提供正規表示式 (regular expression) 做進階的字串處理。當要處理" "複雜的比對以及操作時,正規表示式是簡潔且經過最佳化的解決方案:\n" "\n" "::" #: ../../tutorial/stdlib.rst:124 msgid "" "When only simple capabilities are needed, string methods are preferred " "because they are easier to read and debug::" msgstr "" "當只需要簡單的字串操作時,因為可讀性以及方便除錯,字串本身的 method 是比較建" "議的:\n" "\n" "::" #: ../../tutorial/stdlib.rst:134 msgid "Mathematics" msgstr "數學相關" #: ../../tutorial/stdlib.rst:136 msgid "" "The :mod:`math` module gives access to the underlying C library functions " "for floating point math::" msgstr "" ":mod:`math` 模組提供了 C 函式庫中底層的浮點數運算的函式:\n" "\n" "::" #: ../../tutorial/stdlib.rst:145 msgid "The :mod:`random` module provides tools for making random selections::" msgstr "" ":mod:`random` 模組提供了隨機選擇的工具:\n" "\n" "::" #: ../../tutorial/stdlib.rst:157 msgid "" "The :mod:`statistics` module calculates basic statistical properties (the " "mean, median, variance, etc.) of numeric data::" msgstr "" ":mod:`statistics` 模組提供了替數值資料計算基本統計量(包括平均、中位數、變異" "量數等)的功能:\n" "\n" "::" #: ../../tutorial/stdlib.rst:169 msgid "" "The SciPy project has many other modules for numerical " "computations." msgstr "SciPy 專案 上也有許多數值計算相關的模組。" #: ../../tutorial/stdlib.rst:175 msgid "Internet Access" msgstr "網路存取" #: ../../tutorial/stdlib.rst:177 msgid "" "There are a number of modules for accessing the internet and processing " "internet protocols. Two of the simplest are :mod:`urllib.request` for " "retrieving data from URLs and :mod:`smtplib` for sending mail::" msgstr "" "Python 中有許多存取網路以及處理網路協定。最簡單的兩個例子包括 :mod:`urllib." "request` 模組可以從網址抓取資料以及 :mod:`smtplib` 可以用來寄郵件:\n" "\n" "::" #: ../../tutorial/stdlib.rst:200 msgid "(Note that the second example needs a mailserver running on localhost.)" msgstr "(注意第二個例子中需要在本地端執行一個郵件伺服器。)" #: ../../tutorial/stdlib.rst:206 msgid "Dates and Times" msgstr "日期與時間" #: ../../tutorial/stdlib.rst:208 msgid "" "The :mod:`datetime` module supplies classes for manipulating dates and times " "in both simple and complex ways. While date and time arithmetic is " "supported, the focus of the implementation is on efficient member extraction " "for output formatting and manipulation. The module also supports objects " "that are timezone aware. ::" msgstr "" ":mod:`datetime` 模組提供許多 class 可以操作日期以及時間,從簡單從複雜都有。模" "組支援日期與時間的運算,而實作的重點是有效率的成員擷取以達到輸出格式化以及操" "作。模組也提供支援時區換算的類別。\n" "\n" "::" #: ../../tutorial/stdlib.rst:232 msgid "Data Compression" msgstr "資料壓縮" #: ../../tutorial/stdlib.rst:234 msgid "" "Common data archiving and compression formats are directly supported by " "modules including: :mod:`zlib`, :mod:`gzip`, :mod:`bz2`, :mod:`lzma`, :mod:" "`zipfile` and :mod:`tarfile`. ::" msgstr "" "常見的解壓縮以及壓縮格式都有直接支援的模組。包括:\\ :mod:`zlib`\\ 、\\ :mod:" "`gzip`\\ 、\\ :mod:`bz2`\\ 、\\ :mod:`lzma`\\ 、\\ :mod:`zipfile` 以及 :mod:" "`tarfile`\\ 。\n" "\n" "::" #: ../../tutorial/stdlib.rst:254 msgid "Performance Measurement" msgstr "效能量測" #: ../../tutorial/stdlib.rst:256 msgid "" "Some Python users develop a deep interest in knowing the relative " "performance of different approaches to the same problem. Python provides a " "measurement tool that answers those questions immediately." msgstr "" "有一些 Python 使用者很想了解同個問題的不同實作方法的效能差異。Python 提供了評" "估效能差異的工具。" #: ../../tutorial/stdlib.rst:260 msgid "" "For example, it may be tempting to use the tuple packing and unpacking " "feature instead of the traditional approach to swapping arguments. The :mod:" "`timeit` module quickly demonstrates a modest performance advantage::" msgstr "" "舉例來說,有人可能會試著用 tuple 的打包機制來交換引數代替傳統的方式。\\ :mod:" "`timeit` 模組可以迅速地展示效能的進步:\n" "\n" "::" #: ../../tutorial/stdlib.rst:270 msgid "" "In contrast to :mod:`timeit`'s fine level of granularity, the :mod:`profile` " "and :mod:`pstats` modules provide tools for identifying time critical " "sections in larger blocks of code." msgstr "" "相對於 :mod:`timeit` 模組提供這麼細的粒度,\\ :mod:`profile` 模組以及 :mod:" "`pstats` 模組則提供了一些在大型的程式碼識別時間使用上關鍵的區塊 (time " "critical section) 的工具。" #: ../../tutorial/stdlib.rst:278 msgid "Quality Control" msgstr "品質控管" #: ../../tutorial/stdlib.rst:280 msgid "" "One approach for developing high quality software is to write tests for each " "function as it is developed and to run those tests frequently during the " "development process." msgstr "" "達到高品質軟體的一個方法,是在開發時對每個函式寫測試,以及在開發過程中要不斷" "地跑這些測試。" #: ../../tutorial/stdlib.rst:284 msgid "" "The :mod:`doctest` module provides a tool for scanning a module and " "validating tests embedded in a program's docstrings. Test construction is " "as simple as cutting-and-pasting a typical call along with its results into " "the docstring. This improves the documentation by providing the user with an " "example and it allows the doctest module to make sure the code remains true " "to the documentation::" msgstr "" ":mod:`doctest` 模組提供了一個工具,掃描模組並根據程式中內嵌的文件字串執行測" "試。撰寫測試如同簡單地將它的呼叫及輸出結果剪下並貼上到文件字串中。透過提供範" "例給使用者,它強化了說明文件,並允許 doctest 模組確認程式碼的結果與說明文件一" "致:\n" "\n" "::" #: ../../tutorial/stdlib.rst:302 msgid "" "The :mod:`unittest` module is not as effortless as the :mod:`doctest` " "module, but it allows a more comprehensive set of tests to be maintained in " "a separate file::" msgstr "" ":mod:`unittest` 模組不像 :mod:`doctest` 模組這般容易,但是它讓你可以在另外一" "個檔案裡撰寫更完整的測試集:\n" "\n" "::" #: ../../tutorial/stdlib.rst:324 msgid "Batteries Included" msgstr "標準模組庫" #: ../../tutorial/stdlib.rst:326 msgid "" "Python has a \"batteries included\" philosophy. This is best seen through " "the sophisticated and robust capabilities of its larger packages. For " "example:" msgstr "" "\"Batteries included\" 是 Python 的設計哲學。這個理念可以透過使用它的大型套" "件,感受複雜與強大的功能,來得到印證。例如:" #: ../../tutorial/stdlib.rst:329 msgid "" "The :mod:`xmlrpc.client` and :mod:`xmlrpc.server` modules make implementing " "remote procedure calls into an almost trivial task. Despite the modules' " "names, no direct knowledge or handling of XML is needed." msgstr "" "使用 :mod:`xmlrpc.client` 和 :mod:`xmlrpc.server` 模組使實作遠端程序呼叫變得" "更為容易。即使模組名稱裡有 XML,使用者並不需要直接操作 XML 檔案或事先具備相關" "知識。" #: ../../tutorial/stdlib.rst:333 msgid "" "The :mod:`email` package is a library for managing email messages, including " "MIME and other :rfc:`2822`-based message documents. Unlike :mod:`smtplib` " "and :mod:`poplib` which actually send and receive messages, the email " "package has a complete toolset for building or decoding complex message " "structures (including attachments) and for implementing internet encoding " "and header protocols." msgstr "" "函式庫 :mod:`email` 套件用來管理 MIME 和其他 :rfc:`2822` 相關電子郵件訊息的文" "件。相異於 :mod:`smtplib` 和 :mod:`poplib` 這些實際用來發送與接收訊息的模組," "email 套件擁有更完整的工具集,可用於建立與解碼複雜訊息結構(包含附件檔案)以" "及實作編碼與標頭協定。" #: ../../tutorial/stdlib.rst:340 msgid "" "The :mod:`json` package provides robust support for parsing this popular " "data interchange format. The :mod:`csv` module supports direct reading and " "writing of files in Comma-Separated Value format, commonly supported by " "databases and spreadsheets. XML processing is supported by the :mod:`xml." "etree.ElementTree`, :mod:`xml.dom` and :mod:`xml.sax` packages. Together, " "these modules and packages greatly simplify data interchange between Python " "applications and other tools." msgstr "" ":mod:`json` 套件對 JSON 資料交換格式的剖析,提供強大的支援。\\ :mod:`csv` 模" "組則提供直接讀寫 CSV(以逗號分隔值的檔案格式,通常資料庫和電子表格都有支" "援)。\\ :mod:`xml.etree.ElementTree`\\ 、\\ :mod:`xml.dom` 與 :mod:`xml." "sax` 套件則支援 XML 的處理。綜觀所有,這些模組和套件都簡化了 Python 應用程式" "與其他工具之間的資料交換。" #: ../../tutorial/stdlib.rst:349 msgid "" "The :mod:`sqlite3` module is a wrapper for the SQLite database library, " "providing a persistent database that can be updated and accessed using " "slightly nonstandard SQL syntax." msgstr "" ":mod:`sqllite3` 模組是 SQLite 資料庫函式庫的一層包裝,提供一個具持久性的資料" "庫,可以使用稍微非標準的 SQL 語法來對它進行更新與存取。" #: ../../tutorial/stdlib.rst:353 msgid "" "Internationalization is supported by a number of modules including :mod:" "`gettext`, :mod:`locale`, and the :mod:`codecs` package." msgstr "" "有數種支援國際化的模組,包括 :mod:`gettext`\\ 、\\ :mod:`locale` 和 :mod:" "`codecs` 等套件。" #~ msgid "" #~ "The :mod:`getopt` module processes *sys.argv* using the conventions of " #~ "the Unix :func:`getopt` function. More powerful and flexible command " #~ "line processing is provided by the :mod:`argparse` module." #~ msgstr "" #~ ":mod:`getopt` 模組使用Unix :func:`getopt` 函式來處理 *sys.argv*。更強大且" #~ "具有彈性的命令列處理可由 :mod:`argparse` 模組提供。"
X Tutup