8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 53d5e67 commit 177b9cbCopy full SHA for 177b9cb
Doc/library/struct.rst
@@ -160,6 +160,21 @@ following table:
160
161
If the first character is not one of these, ``'@'`` is assumed.
162
163
+.. note::
164
+
165
+ The number 1023 (``0x3ff`` in hexadecimal) has the following byte representations:
166
167
+ * ``03 ff`` in big-endian (``>``)
168
+ * ``ff 03`` in little-endian (``<``)
169
170
+ Python example:
171
172
+ >>> import struct
173
+ >>> struct.pack('>h', 1023)
174
+ b'\x03\xff'
175
+ >>> struct.pack('<h', 1023)
176
+ b'\xff\x03'
177
178
Native byte order is big-endian or little-endian, depending on the
179
host system. For example, Intel x86, AMD64 (x86-64), and Apple M1 are
180
little-endian; IBM z and many legacy architectures are big-endian.
0 commit comments