@@ -11,7 +11,7 @@ msgstr ""
11
11
"Project-Id-Version : Python 3.9\n "
12
12
"Report-Msgid-Bugs-To : \n "
13
13
"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 "
15
15
"
Last-Translator :
Adrian Liaw <[email protected] >\n "
16
16
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
17
17
"tw)\n "
@@ -93,6 +93,9 @@ msgid ""
93
93
"allows users to customize their applications without having to alter the "
94
94
"application."
95
95
msgstr ""
96
+ ":mod:`string` 模組包含一個多功能的 :class:`~string.Template` class,具有適合"
97
+ "使用者進行編輯的簡化語法。它容許使用者客製化自己的應用程式,但不必對原應用程"
98
+ "式做出變更。"
96
99
97
100
#: ../../tutorial/stdlib2.rst:78
98
101
msgid ""
@@ -102,6 +105,12 @@ msgid ""
102
105
"letters with no intervening spaces. Writing ``$$`` creates a single escaped "
103
106
"``$``::"
104
107
msgstr ""
108
+ "格式化方式是使用佔位符號名稱 (placeholder name),它是由 ``$`` 加上合法的 "
109
+ "Python 識別符(字母、數字和下底線)構成。若使用大括號將佔位符號包起來,就可以"
110
+ "在後面接上更多的字母和數字而無需插入空格。寫入 ``$$`` 將會跳脫為單一字元 `"
111
+ "$`:\n"
112
+ "\n"
113
+ "::"
105
114
106
115
#: ../../tutorial/stdlib2.rst:88
107
116
msgid ""
@@ -111,6 +120,13 @@ msgid ""
111
120
"meth:`~string.Template.safe_substitute` method may be more appropriate --- "
112
121
"it will leave placeholders unchanged if data is missing::"
113
122
msgstr ""
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
+ "::"
114
130
115
131
#: ../../tutorial/stdlib2.rst:103
116
132
msgid ""
@@ -119,17 +135,24 @@ msgid ""
119
135
"placeholders such as the current date, image sequence number, or file "
120
136
"format::"
121
137
msgstr ""
138
+ "Template 的 subclass(子類別)可以指定自訂的分隔符號 (delimiter)。例如,一個"
139
+ "相片瀏覽器的批次重新命名功能,可以選擇用百分號作為現在日期、照片序號或檔案格"
140
+ "式的佔位符號:\n"
141
+ "\n"
142
+ "::"
122
143
123
144
#: ../../tutorial/stdlib2.rst:125
124
145
msgid ""
125
146
"Another application for templating is separating program logic from the "
126
147
"details of multiple output formats. This makes it possible to substitute "
127
148
"custom templates for XML files, plain text reports, and HTML web reports."
128
149
msgstr ""
150
+ "模板化的另一個應用,是將程式邏輯與多樣的輸出格式細節分離開來。這樣就可以為 "
151
+ "XML 檔案、純文字報表和 HTML 網路報表替換自訂的模板。"
129
152
130
153
#: ../../tutorial/stdlib2.rst:133
131
154
msgid "Working with Binary Data Record Layouts"
132
- msgstr ""
155
+ msgstr "二進制資料記錄編排 (Binary Data Record Layouts) 的處理 "
133
156
134
157
#: ../../tutorial/stdlib2.rst:135
135
158
msgid ""
@@ -140,10 +163,18 @@ msgid ""
140
163
"\" `` represent two and four byte unsigned numbers respectively. The ``\" <"
141
164
"\" `` indicates that they are standard size and in little-endian byte order::"
142
165
msgstr ""
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
+ "::"
143
174
144
175
#: ../../tutorial/stdlib2.rst:166
145
176
msgid "Multi-threading"
146
- msgstr ""
177
+ msgstr "多執行緒 (Multi-threading) "
147
178
148
179
#: ../../tutorial/stdlib2.rst:168
149
180
msgid ""
@@ -153,12 +184,20 @@ msgid ""
153
184
"background. A related use case is running I/O in parallel with computations "
154
185
"in another thread."
155
186
msgstr ""
187
+ "執行緒是一種技術,其作用是對非順序相依 (sequentially dependent) 的多個任務進"
188
+ "行解耦 (decoupling)。當其他任務在背景執行時,多執行緒可以用來增加應用程式在接"
189
+ "收使用者輸入時的反應能力。一個相關的用例是,運行 I/O 的同時,在另一個執行緒中"
190
+ "進行計算。"
156
191
157
192
#: ../../tutorial/stdlib2.rst:173
158
193
msgid ""
159
194
"The following code shows how the high level :mod:`threading` module can run "
160
195
"tasks in background while the main program continues to run::"
161
196
msgstr ""
197
+ "以下程式碼顯示了高階的 :mod:`threading` 模組如何在背景運行任務,而主程式同時"
198
+ "繼續運行:\n"
199
+ "\n"
200
+ "::"
162
201
163
202
#: ../../tutorial/stdlib2.rst:197
164
203
msgid ""
@@ -167,6 +206,9 @@ msgid ""
167
206
"module provides a number of synchronization primitives including locks, "
168
207
"events, condition variables, and semaphores."
169
208
msgstr ""
209
+ "多執行緒應用程式的主要挑戰是,要協調多個彼此共享資料或資源的執行緒。為此,"
210
+ "threading 模組提供了多個同步處理原始物件 (synchronization primitive),包括鎖 "
211
+ "(lock)、事件 (event)、條件變數 (condition variable) 和號誌 (semaphore)。"
170
212
171
213
#: ../../tutorial/stdlib2.rst:202
172
214
msgid ""
@@ -178,21 +220,29 @@ msgid ""
178
220
"thread communication and coordination are easier to design, more readable, "
179
221
"and more reliable."
180
222
msgstr ""
223
+ "儘管這些工具很強大,但很小的設計錯誤也可能導致一些難以重現的問題。所以,任務"
224
+ "協調的首選方法是,把所有對資源的存取集中到單一的執行緒中,然後使用 :mod:"
225
+ "`queue` 模組向該執行緒饋送來自其他執行緒的請求。應用程式若使用 :class:"
226
+ "`~queue.Queue` 物件進行執行緒間的通信和協調,會更易於設計、更易讀、更可靠。"
181
227
182
228
#: ../../tutorial/stdlib2.rst:213
183
229
msgid "Logging"
184
- msgstr ""
230
+ msgstr "日誌記錄 (Logging) "
185
231
186
232
#: ../../tutorial/stdlib2.rst:215
187
233
msgid ""
188
234
"The :mod:`logging` module offers a full featured and flexible logging "
189
235
"system. At its simplest, log messages are sent to a file or to ``sys."
190
236
"stderr``::"
191
237
msgstr ""
238
+ ":mod:`logging` 模組提供功能齊全且富彈性的日誌記錄系統。在最簡單的情況下,日誌"
239
+ "訊息會被發送到檔案或 ``sys.stderr``:\n"
240
+ "\n"
241
+ "::"
192
242
193
243
#: ../../tutorial/stdlib2.rst:225
194
244
msgid "This produces the following output:"
195
- msgstr ""
245
+ msgstr "這會產生以下輸出: "
196
246
197
247
#: ../../tutorial/stdlib2.rst:233
198
248
msgid ""
@@ -203,24 +253,35 @@ msgid ""
203
253
"`~logging.DEBUG`, :const:`~logging.INFO`, :const:`~logging.WARNING`, :const:"
204
254
"`~logging.ERROR`, and :const:`~logging.CRITICAL`."
205
255
msgstr ""
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`\\ 。"
206
262
207
263
#: ../../tutorial/stdlib2.rst:240
208
264
msgid ""
209
265
"The logging system can be configured directly from Python or can be loaded "
210
266
"from a user editable configuration file for customized logging without "
211
267
"altering the application."
212
268
msgstr ""
269
+ "日誌記錄系統可以直接從 Python 配置,也可以從使用者可編輯的配置檔案載入,以進"
270
+ "行客製化的日誌記錄而無須對應用程式做出變動。"
213
271
214
272
#: ../../tutorial/stdlib2.rst:248
215
273
msgid "Weak References"
216
- msgstr ""
274
+ msgstr "弱引用 (Weak References) "
217
275
218
276
#: ../../tutorial/stdlib2.rst:250
219
277
msgid ""
220
278
"Python does automatic memory management (reference counting for most objects "
221
279
"and :term:`garbage collection` to eliminate cycles). The memory is freed "
222
280
"shortly after the last reference to it has been eliminated."
223
281
msgstr ""
282
+ "Python 會自動進行記憶體管理(對大多數物件進行參照計數 (reference counting) 並"
283
+ "使用 :term:`garbage collection` 來消除循環參照)。當一個參照從記憶體被移除後"
284
+ "不久,該記憶體就會被釋出。"
224
285
225
286
#: ../../tutorial/stdlib2.rst:254
226
287
msgid ""
@@ -233,17 +294,27 @@ msgid ""
233
294
"weakref objects. Typical applications include caching objects that are "
234
295
"expensive to create::"
235
296
msgstr ""
297
+ "此方式對大多數應用程式來說都沒問題,但偶爾也需要在物件仍然被其他物件所使用時"
298
+ "持續追蹤它們。可惜的是,儘管只是追蹤它們,也會建立一個使它們永久化 "
299
+ "(permanent) 的參照。\\ :mod:`weakref` 模組提供的工具可以不必建立參照就能追蹤"
300
+ "物件。當該物件不再被需要時,它會自動從一個弱引用表 (weakref table) 中被移除,"
301
+ "並為弱引用物件觸發一個回呼 (callback)。典型的應用包括暫存 (cache) 那些較佔空"
302
+ "間的物件:\n"
303
+ "\n"
304
+ "::"
236
305
237
306
#: ../../tutorial/stdlib2.rst:289
238
307
msgid "Tools for Working with Lists"
239
- msgstr ""
308
+ msgstr "使用於 List 的工具 "
240
309
241
310
#: ../../tutorial/stdlib2.rst:291
242
311
msgid ""
243
312
"Many data structure needs can be met with the built-in list type. However, "
244
313
"sometimes there is a need for alternative implementations with different "
245
314
"performance trade-offs."
246
315
msgstr ""
316
+ "許多對於資料結構的需求,可以透過內建的 list(串列)型別來滿足。但是,有時也會"
317
+ "根據效能的各種取捨,需要一些替代的實作。"
247
318
248
319
#: ../../tutorial/stdlib2.rst:295
249
320
msgid ""
@@ -253,6 +324,12 @@ msgid ""
253
324
"binary numbers (typecode ``\" H\" ``) rather than the usual 16 bytes per entry "
254
325
"for regular lists of Python int objects::"
255
326
msgstr ""
327
+ ":mod:`array` 模組提供了一個 :class:`~array.array()` 物件,它像是 list,但只能"
328
+ "儲存同類的資料且能緊密地儲存。下面的範例展示一個數值陣列 (array),以兩個位元"
329
+ "組的無符號二進數 (unsigned binary numbers) 為儲存單位(類型碼為 ``\" H\" ``),"
330
+ "而在 Python 整數物件的正規 list 中,每個項目通常使用 16 個位元組:\n"
331
+ "\n"
332
+ "::"
256
333
257
334
#: ../../tutorial/stdlib2.rst:308
258
335
msgid ""
@@ -261,13 +338,23 @@ msgid ""
261
338
"but slower lookups in the middle. These objects are well suited for "
262
339
"implementing queues and breadth first tree searches::"
263
340
msgstr ""
341
+ ":mod:`collections` 模組提供了一個 :class:`~collections.deque()` 物件,它像是 "
342
+ "list,但從左側加入 (append) 和彈出 (pop) 的速度較快,而在中間查找的速度則較"
343
+ "慢。這種物件適用於實作佇列 (queue) 和廣度優先搜尋法 (breadth first tree "
344
+ "search):\n"
345
+ "\n"
346
+ "::"
264
347
265
348
#: ../../tutorial/stdlib2.rst:329
266
349
msgid ""
267
350
"In addition to alternative list implementations, the library also offers "
268
351
"other tools such as the :mod:`bisect` module with functions for manipulating "
269
352
"sorted lists::"
270
353
msgstr ""
354
+ "除了替代的 list 實作以外,函式庫也提供了其他工具,例如 :mod:`bisect` 模組,具"
355
+ "有能夠操作 sorted list(已排序串列)的函式:\n"
356
+ "\n"
357
+ "::"
271
358
272
359
#: ../../tutorial/stdlib2.rst:339
273
360
msgid ""
@@ -276,48 +363,60 @@ msgid ""
276
363
"This is useful for applications which repeatedly access the smallest element "
277
364
"but do not want to run a full list sort::"
278
365
msgstr ""
366
+ ":mod:`heapq` 模組提供了一些函式,能基於正規 list 來實作堆積 (heap)。最小值的"
367
+ "項目會永遠保持在位置零。對於一些需要多次存取最小元素,但不想要對整個 list 進"
368
+ "行排序的應用程式來說,這會很有用:\n"
369
+ "\n"
370
+ "::"
279
371
280
372
#: ../../tutorial/stdlib2.rst:355
281
373
msgid "Decimal Floating Point Arithmetic"
282
- msgstr ""
374
+ msgstr "十進制 (Decimal) 浮點數運算 "
283
375
284
376
#: ../../tutorial/stdlib2.rst:357
285
377
msgid ""
286
378
"The :mod:`decimal` module offers a :class:`~decimal.Decimal` datatype for "
287
379
"decimal floating point arithmetic. Compared to the built-in :class:`float` "
288
380
"implementation of binary floating point, the class is especially helpful for"
289
381
msgstr ""
382
+ ":mod:`decimal` 模組提供了一個 :class:`~decimal.Decimal` 資料類型,用於十進制"
383
+ "浮點數運算。相較於內建的二進制浮點數 :class:`float` 實作,該 class 特別適用於"
290
384
291
385
#: ../../tutorial/stdlib2.rst:361
292
386
msgid ""
293
387
"financial applications and other uses which require exact decimal "
294
388
"representation,"
295
- msgstr ""
389
+ msgstr "金融應用程式及其他需要準確十進位制表示法的應用, "
296
390
297
391
#: ../../tutorial/stdlib2.rst:363
298
392
msgid "control over precision,"
299
- msgstr ""
393
+ msgstr "對於精確度 (precision) 的控制, "
300
394
301
395
#: ../../tutorial/stdlib2.rst:364
302
396
msgid "control over rounding to meet legal or regulatory requirements,"
303
- msgstr ""
397
+ msgstr "控制四捨五入,以滿足法律或監管規範, "
304
398
305
399
#: ../../tutorial/stdlib2.rst:365
306
400
msgid "tracking of significant decimal places, or"
307
- msgstr ""
401
+ msgstr "追蹤有效的小數位數 (decimal place),或 "
308
402
309
403
#: ../../tutorial/stdlib2.rst:366
310
404
msgid ""
311
405
"applications where the user expects the results to match calculations done "
312
406
"by hand."
313
- msgstr ""
407
+ msgstr "使用者會期望計算結果與手工計算相符的應用程式。 "
314
408
315
409
#: ../../tutorial/stdlib2.rst:369
316
410
msgid ""
317
411
"For example, calculating a 5% tax on a 70 cent phone charge gives different "
318
412
"results in decimal floating point and binary floating point. The difference "
319
413
"becomes significant if the results are rounded to the nearest cent::"
320
414
msgstr ""
415
+ "例如,要計算 70 美分的手機充電加上 5% 稅金的總價,使用十進制浮點數和二進制浮"
416
+ "點數,會算出不同的答案。如果把計算結果四捨五入到最接近的美分,兩者的差異會更"
417
+ "顯著:\n"
418
+ "\n"
419
+ "::"
321
420
322
421
#: ../../tutorial/stdlib2.rst:379
323
422
msgid ""
@@ -327,16 +426,26 @@ msgid ""
327
426
"issues that can arise when binary floating point cannot exactly represent "
328
427
"decimal quantities."
329
428
msgstr ""
429
+ ":class:`~decimal.Decimal` 的運算結果會保留尾部的零,也會根據有兩個有效位數的"
430
+ "被乘數自動推斷出有四個有效位數的乘積。Decimal 可以重現手工計算的結果,以避免"
431
+ "產生二進制浮點數無法準確表示十進制數值時會導致的問題。"
330
432
331
433
#: ../../tutorial/stdlib2.rst:385
332
434
msgid ""
333
435
"Exact representation enables the :class:`~decimal.Decimal` class to perform "
334
436
"modulo calculations and equality tests that are unsuitable for binary "
335
437
"floating point::"
336
438
msgstr ""
439
+ "準確的表示法使得 :class:`~decimal.Decimal` class 能夠執行對於二進制浮點數不適"
440
+ "用的模數計算和相等性檢測:\n"
441
+ "\n"
442
+ "::"
337
443
338
444
#: ../../tutorial/stdlib2.rst:399
339
445
msgid ""
340
446
"The :mod:`decimal` module provides arithmetic with as much precision as "
341
447
"needed::"
342
448
msgstr ""
449
+ ":mod:`decimal` 模組可提供運算中需要的足夠精確度:\n"
450
+ "\n"
451
+ "::"
0 commit comments