@@ -11,7 +11,7 @@ msgstr ""
1111"Project-Id-Version : Python 3.9\n "
1212"Report-Msgid-Bugs-To : \n "
1313"POT-Creation-Date : 2018-06-26 18:54+0800\n "
14- "PO-Revision-Date : 2021-06-07 12:48 +0800\n "
14+ "PO-Revision-Date : 2021-06-19 14:24 +0800\n "
1515"
Last-Translator :
Adrian Liaw <[email protected] >\n "
1616"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
1717"tw)\n "
@@ -93,6 +93,9 @@ msgid ""
9393"allows users to customize their applications without having to alter the "
9494"application."
9595msgstr ""
96+ ":mod:`string` 模組包含一個多功能的 :class:`~string.Template` class,具有適合"
97+ "使用者進行編輯的簡化語法。它容許使用者客製化自己的應用程式,但不必對原應用程"
98+ "式做出變更。"
9699
97100#: ../../tutorial/stdlib2.rst:78
98101msgid ""
@@ -102,6 +105,12 @@ msgid ""
102105"letters with no intervening spaces. Writing ``$$`` creates a single escaped "
103106"``$``::"
104107msgstr ""
108+ "格式化方式是使用佔位符號名稱 (placeholder name),它是由 ``$`` 加上合法的 "
109+ "Python 識別符(字母、數字和下底線)構成。若使用大括號將佔位符號包起來,就可以"
110+ "在後面接上更多的字母和數字而無需插入空格。寫入 ``$$`` 將會跳脫為單一字元 `"
111+ "$`:\n"
112+ "\n"
113+ "::"
105114
106115#: ../../tutorial/stdlib2.rst:88
107116msgid ""
@@ -111,6 +120,13 @@ msgid ""
111120"meth:`~string.Template.safe_substitute` method may be more appropriate --- "
112121"it will leave placeholders unchanged if data is missing::"
113122msgstr ""
123+ "如果在 dictionary 或關鍵字引數中未提供某個佔位符號的值,那麼 :meth:`~string."
124+ "Template.substitute` method 將引發 :exc:`KeyError`\\ 。對於郵件合併 (mail-"
125+ "merge) 類型的應用程式,使用者提供的資料有可能是不完整的,此時使用 :meth:"
126+ "`~string.Template.safe_substitute` method 會更適當——如果資料有缺少,它會讓佔"
127+ "位符號保持不變:\n"
128+ "\n"
129+ "::"
114130
115131#: ../../tutorial/stdlib2.rst:103
116132msgid ""
@@ -119,17 +135,24 @@ msgid ""
119135"placeholders such as the current date, image sequence number, or file "
120136"format::"
121137msgstr ""
138+ "Template 的 subclass(子類別)可以指定自訂的分隔符號 (delimiter)。例如,一個"
139+ "相片瀏覽器的批次重新命名功能,可以選擇用百分號作為現在日期、照片序號或檔案格"
140+ "式的佔位符號:\n"
141+ "\n"
142+ "::"
122143
123144#: ../../tutorial/stdlib2.rst:125
124145msgid ""
125146"Another application for templating is separating program logic from the "
126147"details of multiple output formats. This makes it possible to substitute "
127148"custom templates for XML files, plain text reports, and HTML web reports."
128149msgstr ""
150+ "模板化的另一個應用,是將程式邏輯與多樣的輸出格式細節分離開來。這樣就可以為 "
151+ "XML 檔案、純文字報表和 HTML 網路報表替換自訂的模板。"
129152
130153#: ../../tutorial/stdlib2.rst:133
131154msgid "Working with Binary Data Record Layouts"
132- msgstr ""
155+ msgstr "二進制資料記錄編排 (Binary Data Record Layouts) 的處理 "
133156
134157#: ../../tutorial/stdlib2.rst:135
135158msgid ""
@@ -140,10 +163,18 @@ msgid ""
140163"\" `` represent two and four byte unsigned numbers respectively. The ``\" <"
141164"\" `` indicates that they are standard size and in little-endian byte order::"
142165msgstr ""
166+ ":mod:`struct` 模組提供了 :func:`~struct.pack` 和 :func:`~struct.unpack` 函"
167+ "式,用於處理不定長度的二進制記錄格式。以下範例說明,如何在不使用 :mod:"
168+ "`zipfile` 模組的情況下,使用迴圈瀏覽一個 ZIP 檔案中的標頭資訊 (header "
169+ "information)。壓縮程式碼 ``\" H\" `` 和 ``\" I\" `` 分別代表兩個和四個位元組的無"
170+ "符號數 (unsigned number)。\\ ``\" <\" `` 表示它們是標準大小,並使用小端 "
171+ "(little-endian) 位元組順序:\n"
172+ "\n"
173+ "::"
143174
144175#: ../../tutorial/stdlib2.rst:166
145176msgid "Multi-threading"
146- msgstr ""
177+ msgstr "多執行緒 (Multi-threading) "
147178
148179#: ../../tutorial/stdlib2.rst:168
149180msgid ""
@@ -153,12 +184,20 @@ msgid ""
153184"background. A related use case is running I/O in parallel with computations "
154185"in another thread."
155186msgstr ""
187+ "執行緒是一種技術,其作用是對非順序相依 (sequentially dependent) 的多個任務進"
188+ "行解耦 (decoupling)。當其他任務在背景執行時,多執行緒可以用來增加應用程式在接"
189+ "收使用者輸入時的反應能力。一個相關的用例是,運行 I/O 的同時,在另一個執行緒中"
190+ "進行計算。"
156191
157192#: ../../tutorial/stdlib2.rst:173
158193msgid ""
159194"The following code shows how the high level :mod:`threading` module can run "
160195"tasks in background while the main program continues to run::"
161196msgstr ""
197+ "以下程式碼顯示了高階的 :mod:`threading` 模組如何在背景運行任務,而主程式同時"
198+ "繼續運行:\n"
199+ "\n"
200+ "::"
162201
163202#: ../../tutorial/stdlib2.rst:197
164203msgid ""
@@ -167,6 +206,9 @@ msgid ""
167206"module provides a number of synchronization primitives including locks, "
168207"events, condition variables, and semaphores."
169208msgstr ""
209+ "多執行緒應用程式的主要挑戰是,要協調多個彼此共享資料或資源的執行緒。為此,"
210+ "threading 模組提供了多個同步處理原始物件 (synchronization primitive),包括鎖 "
211+ "(lock)、事件 (event)、條件變數 (condition variable) 和號誌 (semaphore)。"
170212
171213#: ../../tutorial/stdlib2.rst:202
172214msgid ""
@@ -178,21 +220,29 @@ msgid ""
178220"thread communication and coordination are easier to design, more readable, "
179221"and more reliable."
180222msgstr ""
223+ "儘管這些工具很強大,但很小的設計錯誤也可能導致一些難以重現的問題。所以,任務"
224+ "協調的首選方法是,把所有對資源的存取集中到單一的執行緒中,然後使用 :mod:"
225+ "`queue` 模組向該執行緒饋送來自其他執行緒的請求。應用程式若使用 :class:"
226+ "`~queue.Queue` 物件進行執行緒間的通信和協調,會更易於設計、更易讀、更可靠。"
181227
182228#: ../../tutorial/stdlib2.rst:213
183229msgid "Logging"
184- msgstr ""
230+ msgstr "日誌記錄 (Logging) "
185231
186232#: ../../tutorial/stdlib2.rst:215
187233msgid ""
188234"The :mod:`logging` module offers a full featured and flexible logging "
189235"system. At its simplest, log messages are sent to a file or to ``sys."
190236"stderr``::"
191237msgstr ""
238+ ":mod:`logging` 模組提供功能齊全且富彈性的日誌記錄系統。在最簡單的情況下,日誌"
239+ "訊息會被發送到檔案或 ``sys.stderr``:\n"
240+ "\n"
241+ "::"
192242
193243#: ../../tutorial/stdlib2.rst:225
194244msgid "This produces the following output:"
195- msgstr ""
245+ msgstr "這會產生以下輸出: "
196246
197247#: ../../tutorial/stdlib2.rst:233
198248msgid ""
@@ -203,24 +253,35 @@ msgid ""
203253"`~logging.DEBUG`, :const:`~logging.INFO`, :const:`~logging.WARNING`, :const:"
204254"`~logging.ERROR`, and :const:`~logging.CRITICAL`."
205255msgstr ""
256+ "在預設情況,資訊和除錯訊息不會被顯示,其輸出會被發送到標準錯誤 (standard "
257+ "error)。其他輸出選項包括,將訊息轉發到電子郵件、資料報 (datagram)、網路插座 "
258+ "(socket) 或 HTTP 伺服器。新的過濾器可以根據訊息的優先順序,選擇不同的選路 "
259+ "(routing) 方式:\\ :const:`~logging.DEBUG`\\ ,\\ :const:`~logging.INFO`"
260+ "\\ ,\\ :const:`~logging.WARNING`\\ ,\\ :const:`~logging.ERROR`\\ ,及 :"
261+ "const:`~logging.CRITICAL`\\ 。"
206262
207263#: ../../tutorial/stdlib2.rst:240
208264msgid ""
209265"The logging system can be configured directly from Python or can be loaded "
210266"from a user editable configuration file for customized logging without "
211267"altering the application."
212268msgstr ""
269+ "日誌記錄系統可以直接從 Python 配置,也可以從使用者可編輯的配置檔案載入,以進"
270+ "行客製化的日誌記錄而無須對應用程式做出變動。"
213271
214272#: ../../tutorial/stdlib2.rst:248
215273msgid "Weak References"
216- msgstr ""
274+ msgstr "弱引用 (Weak References) "
217275
218276#: ../../tutorial/stdlib2.rst:250
219277msgid ""
220278"Python does automatic memory management (reference counting for most objects "
221279"and :term:`garbage collection` to eliminate cycles). The memory is freed "
222280"shortly after the last reference to it has been eliminated."
223281msgstr ""
282+ "Python 會自動進行記憶體管理(對大多數物件進行參照計數 (reference counting) 並"
283+ "使用 :term:`garbage collection` 來消除循環參照)。當一個參照從記憶體被移除後"
284+ "不久,該記憶體就會被釋出。"
224285
225286#: ../../tutorial/stdlib2.rst:254
226287msgid ""
@@ -233,17 +294,27 @@ msgid ""
233294"weakref objects. Typical applications include caching objects that are "
234295"expensive to create::"
235296msgstr ""
297+ "此方式對大多數應用程式來說都沒問題,但偶爾也需要在物件仍然被其他物件所使用時"
298+ "持續追蹤它們。可惜的是,儘管只是追蹤它們,也會建立一個使它們永久化 "
299+ "(permanent) 的參照。\\ :mod:`weakref` 模組提供的工具可以不必建立參照就能追蹤"
300+ "物件。當該物件不再被需要時,它會自動從一個弱引用表 (weakref table) 中被移除,"
301+ "並為弱引用物件觸發一個回呼 (callback)。典型的應用包括暫存 (cache) 那些較佔空"
302+ "間的物件:\n"
303+ "\n"
304+ "::"
236305
237306#: ../../tutorial/stdlib2.rst:289
238307msgid "Tools for Working with Lists"
239- msgstr ""
308+ msgstr "使用於 List 的工具 "
240309
241310#: ../../tutorial/stdlib2.rst:291
242311msgid ""
243312"Many data structure needs can be met with the built-in list type. However, "
244313"sometimes there is a need for alternative implementations with different "
245314"performance trade-offs."
246315msgstr ""
316+ "許多對於資料結構的需求,可以透過內建的 list(串列)型別來滿足。但是,有時也會"
317+ "根據效能的各種取捨,需要一些替代的實作。"
247318
248319#: ../../tutorial/stdlib2.rst:295
249320msgid ""
@@ -253,6 +324,12 @@ msgid ""
253324"binary numbers (typecode ``\" H\" ``) rather than the usual 16 bytes per entry "
254325"for regular lists of Python int objects::"
255326msgstr ""
327+ ":mod:`array` 模組提供了一個 :class:`~array.array()` 物件,它像是 list,但只能"
328+ "儲存同類的資料且能緊密地儲存。下面的範例展示一個數值陣列 (array),以兩個位元"
329+ "組的無符號二進數 (unsigned binary numbers) 為儲存單位(類型碼為 ``\" H\" ``),"
330+ "而在 Python 整數物件的正規 list 中,每個項目通常使用 16 個位元組:\n"
331+ "\n"
332+ "::"
256333
257334#: ../../tutorial/stdlib2.rst:308
258335msgid ""
@@ -261,13 +338,23 @@ msgid ""
261338"but slower lookups in the middle. These objects are well suited for "
262339"implementing queues and breadth first tree searches::"
263340msgstr ""
341+ ":mod:`collections` 模組提供了一個 :class:`~collections.deque()` 物件,它像是 "
342+ "list,但從左側加入 (append) 和彈出 (pop) 的速度較快,而在中間查找的速度則較"
343+ "慢。這種物件適用於實作佇列 (queue) 和廣度優先搜尋法 (breadth first tree "
344+ "search):\n"
345+ "\n"
346+ "::"
264347
265348#: ../../tutorial/stdlib2.rst:329
266349msgid ""
267350"In addition to alternative list implementations, the library also offers "
268351"other tools such as the :mod:`bisect` module with functions for manipulating "
269352"sorted lists::"
270353msgstr ""
354+ "除了替代的 list 實作以外,函式庫也提供了其他工具,例如 :mod:`bisect` 模組,具"
355+ "有能夠操作 sorted list(已排序串列)的函式:\n"
356+ "\n"
357+ "::"
271358
272359#: ../../tutorial/stdlib2.rst:339
273360msgid ""
@@ -276,48 +363,60 @@ msgid ""
276363"This is useful for applications which repeatedly access the smallest element "
277364"but do not want to run a full list sort::"
278365msgstr ""
366+ ":mod:`heapq` 模組提供了一些函式,能基於正規 list 來實作堆積 (heap)。最小值的"
367+ "項目會永遠保持在位置零。對於一些需要多次存取最小元素,但不想要對整個 list 進"
368+ "行排序的應用程式來說,這會很有用:\n"
369+ "\n"
370+ "::"
279371
280372#: ../../tutorial/stdlib2.rst:355
281373msgid "Decimal Floating Point Arithmetic"
282- msgstr ""
374+ msgstr "十進制 (Decimal) 浮點數運算 "
283375
284376#: ../../tutorial/stdlib2.rst:357
285377msgid ""
286378"The :mod:`decimal` module offers a :class:`~decimal.Decimal` datatype for "
287379"decimal floating point arithmetic. Compared to the built-in :class:`float` "
288380"implementation of binary floating point, the class is especially helpful for"
289381msgstr ""
382+ ":mod:`decimal` 模組提供了一個 :class:`~decimal.Decimal` 資料類型,用於十進制"
383+ "浮點數運算。相較於內建的二進制浮點數 :class:`float` 實作,該 class 特別適用於"
290384
291385#: ../../tutorial/stdlib2.rst:361
292386msgid ""
293387"financial applications and other uses which require exact decimal "
294388"representation,"
295- msgstr ""
389+ msgstr "金融應用程式及其他需要準確十進位制表示法的應用, "
296390
297391#: ../../tutorial/stdlib2.rst:363
298392msgid "control over precision,"
299- msgstr ""
393+ msgstr "對於精確度 (precision) 的控制, "
300394
301395#: ../../tutorial/stdlib2.rst:364
302396msgid "control over rounding to meet legal or regulatory requirements,"
303- msgstr ""
397+ msgstr "控制四捨五入,以滿足法律或監管規範, "
304398
305399#: ../../tutorial/stdlib2.rst:365
306400msgid "tracking of significant decimal places, or"
307- msgstr ""
401+ msgstr "追蹤有效的小數位數 (decimal place),或 "
308402
309403#: ../../tutorial/stdlib2.rst:366
310404msgid ""
311405"applications where the user expects the results to match calculations done "
312406"by hand."
313- msgstr ""
407+ msgstr "使用者會期望計算結果與手工計算相符的應用程式。 "
314408
315409#: ../../tutorial/stdlib2.rst:369
316410msgid ""
317411"For example, calculating a 5% tax on a 70 cent phone charge gives different "
318412"results in decimal floating point and binary floating point. The difference "
319413"becomes significant if the results are rounded to the nearest cent::"
320414msgstr ""
415+ "例如,要計算 70 美分的手機充電加上 5% 稅金的總價,使用十進制浮點數和二進制浮"
416+ "點數,會算出不同的答案。如果把計算結果四捨五入到最接近的美分,兩者的差異會更"
417+ "顯著:\n"
418+ "\n"
419+ "::"
321420
322421#: ../../tutorial/stdlib2.rst:379
323422msgid ""
@@ -327,16 +426,26 @@ msgid ""
327426"issues that can arise when binary floating point cannot exactly represent "
328427"decimal quantities."
329428msgstr ""
429+ ":class:`~decimal.Decimal` 的運算結果會保留尾部的零,也會根據有兩個有效位數的"
430+ "被乘數自動推斷出有四個有效位數的乘積。Decimal 可以重現手工計算的結果,以避免"
431+ "產生二進制浮點數無法準確表示十進制數值時會導致的問題。"
330432
331433#: ../../tutorial/stdlib2.rst:385
332434msgid ""
333435"Exact representation enables the :class:`~decimal.Decimal` class to perform "
334436"modulo calculations and equality tests that are unsuitable for binary "
335437"floating point::"
336438msgstr ""
439+ "準確的表示法使得 :class:`~decimal.Decimal` class 能夠執行對於二進制浮點數不適"
440+ "用的模數計算和相等性檢測:\n"
441+ "\n"
442+ "::"
337443
338444#: ../../tutorial/stdlib2.rst:399
339445msgid ""
340446"The :mod:`decimal` module provides arithmetic with as much precision as "
341447"needed::"
342448msgstr ""
449+ ":mod:`decimal` 模組可提供運算中需要的足夠精確度:\n"
450+ "\n"
451+ "::"
0 commit comments