@@ -754,9 +754,9 @@ msgstr ""
754754"``'p'`` 格式字元編碼一個「Pascal 字串」,意思是儲存在 *固定位元組數* 中的短變長\\ "
755755"字串,由計數指定。儲存的第一個位元組是字串的長度,或 255,取較小者。字串的位元組\\ "
756756"在其後。如果傳遞給\\ :func:`pack` 的字串太長(長於計數減 1),則只儲存字串的前\\ "
757- "``count-1`` 個位元組。如果字串短於 ``count-1``,則用空位元組填充,使得總共使用\\ "
758- "恰好 count 個位元組。請注意,對於\\ :func:`unpack`,``'p'`` 格式字元消耗 ``count`` \\ "
759- "個位元組,但回傳的字串永遠不能包含超過 255 個位元組。"
757+ "``count-1`` 個位元組。如果字串短於 ``count-1``\ ,則用空位元組填充,使得總共使用\\ "
758+ "恰好 count 個位元組。請注意,對於\\ :func:`unpack`,\\ ``'p'`` 格式字元消耗\\ "
759+ "``count`` 個位元組,但回傳的字串永遠不能包含超過 255 個位元組。"
760760
761761#: ../../library/struct.rst:339
762762msgid ""
@@ -772,18 +772,28 @@ msgid ""
772772"number of bytes. As a special case, ``'0s'`` means a single, empty string "
773773"(while ``'0c'`` means 0 characters)."
774774msgstr ""
775+ "對於 ``'s'`` 格式字元,計數被解釋為位元組的長度,而不是像其他格式字元那樣的重複\\ "
776+ "次數;例如,``'10s'`` 表示一個 10 位元組字串,對應於單一 Python 位元組字串,\\ "
777+ "而 ``'10c'`` 表示 10 個獨立的單位元組字元元素(例如,\\ ``cccccccccc``\ ),對應於\\ "
778+ "十個不同的 Python 位元組物件。(請參見\\ :ref:`struct-examples` 以了解具體差異\\ "
779+ "的示範。)如果未給定計數,則預設為 1。打包時,會適當地截斷或用空位元組填充字串\\ "
780+ "以使其適合。解包時,結果位元組物件總是恰好具有指定的位元組數。作為特殊情況,\\ "
781+ "``'0s'`` 表示單一空字串(而 ``'0c'`` 表示 0 個字元)。"
775782
776783#: ../../library/struct.rst:352
777784msgid ""
778785"A format character may be preceded by an integral repeat count. For "
779786"example, the format string ``'4h'`` means exactly the same as ``'hhhh'``."
780787msgstr ""
788+ "格式字元前面可以加上整數重複次數。例如,格式字串 ``'4h'`` 與 ``'hhhh'``\\ "
789+ "意思完全相同。"
781790
782791#: ../../library/struct.rst:355
783792msgid ""
784793"Whitespace characters between formats are ignored; a count and its format "
785794"must not contain whitespace though."
786795msgstr ""
796+ "格式之間的空白字元會被忽略;但是計數和其格式不能包含空白字元。"
787797
788798#: ../../library/struct.rst:358
789799msgid ""
@@ -792,12 +802,17 @@ msgid ""
792802"``'Q'``), if ``x`` is outside the valid range for that format "
793803"then :exc:`struct.error` is raised."
794804msgstr ""
805+ "當使用整數格式之一(``'b'``、``'B'``、``'h'``、``'H'``、``'i'``、``'I'``、\\ "
806+ "``'l'``、``'L'``、``'q'``、``'Q'``)打包數值 ``x`` 時,如果 ``x`` 超出該\\ "
807+ "格式的有效範圍,則會觸發\\ :exc:`struct.error`。"
795808
796809#: ../../library/struct.rst:363
797810msgid ""
798811"Previously, some of the integer formats wrapped out-of-range values and "
799812"raised :exc:`DeprecationWarning` instead of :exc:`struct.error`."
800813msgstr ""
814+ "以前,一些整數格式會環繞超出範圍的數值並觸發\\ :exc:`DeprecationWarning`\\ "
815+ "而不是\\ :exc:`struct.error`。"
801816
802817#: ../../library/struct.rst:369
803818msgid ""
@@ -806,6 +821,9 @@ msgid ""
806821"used. Either 0 or 1 in the native or standard bool representation will be "
807822"packed, and any non-zero value will be ``True`` when unpacking."
808823msgstr ""
824+ "對於 ``'?'`` 格式字元,回傳值是\\ :const:`True` 或\\ :const:`False`。打包時,\\ "
825+ "使用引數物件的真值。原生或標準布林值表示法中的 0 或 1 將被打包,解包時任何\\ "
826+ "非零值都將為 ``True``。"
809827
810828#: ../../library/struct.rst:379
811829msgid "Examples"
@@ -817,12 +835,15 @@ msgid ""
817835"of any prefix character) may not match what the reader's machine produces as "
818836"that depends on the platform and compiler."
819837msgstr ""
838+ "原生位元組順序範例(由 ``'@'`` 格式前綴或缺少任何前綴字元指定)可能與讀者機器\\ "
839+ "產生的結果不符,因為這取決於平台和編譯器。"
820840
821841#: ../../library/struct.rst:387
822842msgid ""
823843"Pack and unpack integers of three different sizes, using big endian "
824844"ordering::"
825845msgstr ""
846+ "使用大端序打包和解包三種不同大小的整數: ::"
826847
827848#: ../../library/struct.rst:390
828849msgid ""
@@ -844,7 +865,7 @@ msgstr ""
844865
845866#: ../../library/struct.rst:398
846867msgid "Attempt to pack an integer which is too large for the defined field::"
847- msgstr ""
868+ msgstr "嘗試打包對於定義欄位來說太大的整數: :: "
848869
849870#: ../../library/struct.rst:400
850871msgid ""
@@ -861,7 +882,7 @@ msgstr ""
861882#: ../../library/struct.rst:405
862883msgid ""
863884"Demonstrate the difference between ``'s'`` and ``'c'`` format characters::"
864- msgstr ""
885+ msgstr "示範 ``'s'`` 和 ``'c'`` 格式字元之間的差異: :: "
865886
866887#: ../../library/struct.rst:408
867888msgid ""
@@ -880,6 +901,7 @@ msgid ""
880901"Unpacked fields can be named by assigning them to variables or by wrapping "
881902"the result in a named tuple::"
882903msgstr ""
904+ "解包的欄位可以透過將其指派給變數或將結果包裝在具名元組中來命名: ::"
883905
884906#: ../../library/struct.rst:416
885907msgid ""
@@ -908,6 +930,10 @@ msgid ""
908930"integer on a four-byte boundary. In this example, the output was produced on "
909931"a little endian machine::"
910932msgstr ""
933+ "在原生模式下,格式字元的順序可能會影響大小,因為填充是隱式的。在標準模式下,\\ "
934+ "使用者負責插入任何所需的填充。請注意下面第一個 ``pack`` 呼叫中,在打包的 ``'#'``\\ "
935+ "之後加入了三個 NUL 位元組,以將後續整數對齊到四位元組邊界。在此範例中,輸出是在\\ "
936+ "小端序機器上產生的: ::"
911937
912938#: ../../library/struct.rst:432
913939msgid ""
@@ -934,6 +960,8 @@ msgid ""
934960"The following format ``'llh0l'`` results in two pad bytes being added at the "
935961"end, assuming the platform's longs are aligned on 4-byte boundaries::"
936962msgstr ""
963+ "假設平台的 long 對齊到 4 位元組邊界,以下格式 ``'llh0l'`` 會在結尾加入兩個\\ "
964+ "填充位元組: ::"
937965
938966#: ../../library/struct.rst:444
939967msgid ""
@@ -949,27 +977,27 @@ msgstr ":mod:`array` 模組"
949977
950978#: ../../library/struct.rst:451
951979msgid "Packed binary storage of homogeneous data."
952- msgstr ""
980+ msgstr "同質資料的打包二進位儲存。 "
953981
954982#: ../../library/struct.rst:453
955983msgid "Module :mod:`json`"
956984msgstr ":mod:`json` 模組"
957985
958986#: ../../library/struct.rst:454
959987msgid "JSON encoder and decoder."
960- msgstr ""
988+ msgstr "JSON 編碼器和解碼器。 "
961989
962990#: ../../library/struct.rst:456
963991msgid "Module :mod:`pickle`"
964992msgstr ":mod:`pickle` 模組"
965993
966994#: ../../library/struct.rst:457
967995msgid "Python object serialization."
968- msgstr ""
996+ msgstr "Python 物件序列化。 "
969997
970998#: ../../library/struct.rst:463
971999msgid "Applications"
972- msgstr ""
1000+ msgstr "應用 "
9731001
9741002#: ../../library/struct.rst:465
9751003msgid ""
@@ -980,10 +1008,14 @@ msgid ""
9801008"layout (:ref:`standard formats<struct-standard-formats>`). Generally "
9811009"speaking, the format strings constructed for these two domains are distinct."
9821010msgstr ""
1011+ ":mod:`struct` 模組有兩個主要應用:在應用程式內或使用相同編譯器編譯的另一個應用\\ "
1012+ "程式之間進行 Python 和 C 程式碼的資料交換(\\ :ref:`原生格式<struct-native-formats>`),\\ "
1013+ "以及使用約定資料配置的應用程式之間的資料交換(\\ :ref:`標準格式<struct-standard-formats>`)。\\ "
1014+ "一般來說,為這兩個領域構造的格式字串是不同的。"
9831015
9841016#: ../../library/struct.rst:476
9851017msgid "Native Formats"
986- msgstr ""
1018+ msgstr "原生格式 "
9871019
9881020#: ../../library/struct.rst:478
9891021msgid ""
@@ -995,11 +1027,15 @@ msgid ""
9951027"format string to round up to the correct byte boundary for proper alignment "
9961028"of consecutive chunks of data."
9971029msgstr ""
1030+ "當構造模擬原生配置的格式字串時,編譯器和機器架構決定位元組順序和填充。在這種\\ "
1031+ "情況下,應該使用 ``@`` 格式字元來指定原生位元組順序和資料大小。內部填充位元組\\ "
1032+ "通常會自動插入。可能需要在格式字串的結尾使用零重複格式代碼來向上舍入到正確的\\ "
1033+ "位元組邊界,以便正確對齊連續的資料區塊。"
9981034
9991035#: ../../library/struct.rst:486
10001036msgid ""
10011037"Consider these two simple examples (on a 64-bit, little-endian machine)::"
1002- msgstr ""
1038+ msgstr "考慮這兩個簡單範例(在 64 位元小端序機器上): :: "
10031039
10041040#: ../../library/struct.rst:489
10051041msgid ""
@@ -1019,6 +1055,8 @@ msgid ""
10191055"string without the use of extra padding. A zero-repeat format code solves "
10201056"that problem::"
10211057msgstr ""
1058+ "在第二個格式字串的結尾,如果不使用額外填充,資料不會填充到 8 位元組邊界。\\ "
1059+ "零重複格式代碼解決了這個問題: ::"
10221060
10231061#: ../../library/struct.rst:498
10241062msgid ""
@@ -1033,16 +1071,19 @@ msgid ""
10331071"The ``'x'`` format code can be used to specify the repeat, but for native "
10341072"formats it is better to use a zero-repeat format like ``'0l'``."
10351073msgstr ""
1074+ "``'x'`` 格式代碼可以用來指定重複,但對於原生格式,最好使用像 ``'0l'`` 這樣的\\ "
1075+ "零重複格式。"
10361076
10371077#: ../../library/struct.rst:504
10381078msgid ""
10391079"By default, native byte ordering and alignment is used, but it is better to "
10401080"be explicit and use the ``'@'`` prefix character."
10411081msgstr ""
1082+ "預設使用原生位元組順序和對齊,但最好明確使用 ``'@'`` 前綴字元。"
10421083
10431084#: ../../library/struct.rst:511
10441085msgid "Standard Formats"
1045- msgstr ""
1086+ msgstr "標準格式 "
10461087
10471088#: ../../library/struct.rst:513
10481089msgid ""
@@ -1057,6 +1098,12 @@ msgid ""
10571098"must explicitly add ``'x'`` pad bytes where needed. Revisiting the examples "
10581099"from the previous section, we have::"
10591100msgstr ""
1101+ "當與您的程序之外的網路或儲存等交換資料時,要精確。指定確切的位元組順序、大小\\ "
1102+ "和對齊。不要假設它們與特定機器的原生順序匹配。例如,網路位元組順序是大端序,\\ "
1103+ "而許多流行的 CPU 是小端序。透過明確定義這一點,使用者無需關心其程式碼運行的\\ "
1104+ "平台細節。第一個字元通常應該是 ``<`` 或 ``>``\ (或 ``!``\ )。填充是程式設計師\\ "
1105+ "的責任。零重複格式字元不會起作用。相反,使用者必須在需要的地方明確加入 ``'x'``\\ "
1106+ "填充位元組。重新檢視上一節的範例,我們有: ::"
10601107
10611108#: ../../library/struct.rst:525
10621109msgid ""
@@ -1096,6 +1143,8 @@ msgid ""
10961143"when executed on different machines. For example, the examples below were "
10971144"executed on a 32-bit machine::"
10981145msgstr ""
1146+ "上述結果(在 64 位元機器上執行)在不同機器上執行時不保證匹配。例如,下面的\\ "
1147+ "範例是在 32 位元機器上執行的: ::"
10991148
11001149#: ../../library/struct.rst:544
11011150msgid ""
@@ -1128,64 +1177,77 @@ msgid ""
11281177"its methods is more efficient than calling module-level functions with the "
11291178"same format since the format string is only compiled once."
11301179msgstr ""
1180+ "回傳一個新的 Struct 物件,它根據格式字串 *format* 寫入和讀取二進位資料。\\ "
1181+ "建立一次 ``Struct`` 物件並呼叫其方法比使用相同格式呼叫模組層級函式更有效率,\\ "
1182+ "因為格式字串只編譯一次。"
11311183
11321184#: ../../library/struct.rst:569
11331185msgid ""
11341186"The compiled versions of the most recent format strings passed to the module-"
11351187"level functions are cached, so programs that use only a few format strings "
11361188"needn't worry about reusing a single :class:`Struct` instance."
11371189msgstr ""
1190+ "傳遞給模組層級函式的最近格式字串的編譯版本會被快取,因此僅使用少數格式字串的\\ "
1191+ "程式無需擔心重複使用單一\\ :class:`Struct` 實例。"
11381192
11391193#: ../../library/struct.rst:574
11401194msgid "Compiled Struct objects support the following methods and attributes:"
1141- msgstr ""
1195+ msgstr "編譯的 Struct 物件支援以下方法和屬性: "
11421196
11431197#: ../../library/struct.rst:578
11441198msgid ""
11451199"Identical to the :func:`pack` function, using the compiled format. "
11461200"(``len(result)`` will equal :attr:`size`.)"
11471201msgstr ""
1202+ "與\\ :func:`pack` 函式相同,使用編譯的格式。(``len(result)`` 將等於\\ :attr:`size`。)"
11481203
11491204#: ../../library/struct.rst:584
11501205msgid "Identical to the :func:`pack_into` function, using the compiled format."
1151- msgstr ""
1206+ msgstr "與 \\ :func:`pack_into` 函式相同,使用編譯的格式。 "
11521207
11531208#: ../../library/struct.rst:589
11541209msgid ""
11551210"Identical to the :func:`unpack` function, using the compiled format. The "
11561211"buffer's size in bytes must equal :attr:`size`."
11571212msgstr ""
1213+ "與\\ :func:`unpack` 函式相同,使用編譯的格式。緩衝區的位元組大小必須等於\\ :attr:`size`。"
11581214
11591215#: ../../library/struct.rst:595
11601216msgid ""
11611217"Identical to the :func:`unpack_from` function, using the compiled format. "
11621218"The buffer's size in bytes, starting at position *offset*, must be at "
11631219"least :attr:`size`."
11641220msgstr ""
1221+ "與\\ :func:`unpack_from` 函式相同,使用編譯的格式。緩衝區從位置 *offset*\\ "
1222+ "開始的位元組大小必須至少為\\ :attr:`size`。"
11651223
11661224#: ../../library/struct.rst:602
11671225msgid ""
11681226"Identical to the :func:`iter_unpack` function, using the compiled format. "
11691227"The buffer's size in bytes must be a multiple of :attr:`size`."
11701228msgstr ""
1229+ "與\\ :func:`iter_unpack` 函式相同,使用編譯的格式。緩衝區的位元組大小必須是\\ :attr:`size`\\ "
1230+ "的倍數。"
11711231
11721232#: ../../library/struct.rst:609
11731233msgid "The format string used to construct this Struct object."
1174- msgstr ""
1234+ msgstr "用於構造此 Struct 物件的格式字串。 "
11751235
11761236#: ../../library/struct.rst:611
11771237msgid "The format string type is now :class:`str` instead of :class:`bytes`."
1178- msgstr ""
1238+ msgstr "格式字串型別現在是 \\ :class:`str` 而不是 \\ :class:`bytes`。 "
11791239
11801240#: ../../library/struct.rst:616
11811241msgid ""
11821242"The calculated size of the struct (and hence of the bytes object produced by "
11831243"the :meth:`pack` method) corresponding to :attr:`format`."
11841244msgstr ""
1245+ "對應於\\ :attr:`format` 的結構的計算大小(因此也是\\ :meth:`pack` 方法所產生的\\ "
1246+ "bytes 物件的大小)。"
11851247
11861248#: ../../library/struct.rst:619
11871249msgid "The *repr()* of structs has changed. It is now:"
1188- msgstr ""
1250+ msgstr "結構的 *repr()* 已經改變。現在是: "
11891251
11901252#: ../../library/struct.rst:13
11911253msgid "C"