11\section {\module {struct} ---
2- Interpret strings as packed binary data. }
2+ Interpret strings as packed binary data }
33\declaremodule {builtin}{struct}
44
55\modulesynopsis {Interpret strings as packed binary data.}
66
7- \indexii {C@\C {}}{structures}
7+ \indexii {C}{structures}
8+ \indexiii {packing}{binary}{data}
89
9- This module performs conversions between Python values and \C {}
10+ This module performs conversions between Python values and C
1011structs represented as Python strings. It uses \dfn {format strings}
11- (explained below) as compact descriptions of the lay-out of the \C {}
12- structs and the intended conversion to/from Python values.
12+ (explained below) as compact descriptions of the lay-out of the C
13+ structs and the intended conversion to/from Python values. This can
14+ be used in handling binary data stored in files or from network
15+ connections, among other sources.
1316
1417The module defines the following exception and functions:
1518
@@ -40,7 +43,7 @@ \section{\module{struct} ---
4043\end {funcdesc }
4144
4245Format characters have the following meaning; the conversion between
43- \C {} and Python values should be obvious given their types:
46+ C and Python values should be obvious given their types:
4447
4548\begin {tableiii }{c|l|l}{samp}{Format}{C Type}{Python}
4649 \lineiii {x}{pad byte}{no value}
@@ -96,9 +99,9 @@ \section{\module{struct} ---
9699meaning a Python long integer will be used to hold the pointer; other
97100platforms use 32-bit pointers and will use a Python integer.
98101
99- By default, \C {} numbers are represented in the machine's native format
102+ By default, C numbers are represented in the machine's native format
100103and byte order, and properly aligned by skipping pad bytes if
101- necessary (according to the rules used by the \C {} compiler).
104+ necessary (according to the rules used by the C compiler).
102105
103106Alternatively, the first character of the format string can be used to
104107indicate the byte order, size and alignment of the packed data,
@@ -118,7 +121,7 @@ \section{\module{struct} ---
118121host system (e.g. Motorola and Sun are big-endian; Intel and DEC are
119122little-endian).
120123
121- Native size and alignment are determined using the \C {} compiler's
124+ Native size and alignment are determined using the C compiler's
122125\keyword {sizeof} expression. This is always combined with native byte
123126order.
124127
@@ -168,6 +171,6 @@ \section{\module{struct} ---
168171standard size and alignment does not enforce any alignment.
169172
170173\begin {seealso }
171- \seemodule {array}{packed binary storage of homogeneous data}
172- \seemodule {xdrlib}{packing and unpacking of XDR data}
174+ \seemodule {array}{Packed binary storage of homogeneous data. }
175+ \seemodule {xdrlib}{Packing and unpacking of XDR data. }
173176\end {seealso }
0 commit comments