diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index 416b01db615..54d717c5397 100644 --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -156,6 +156,21 @@ following table: If the first character is not one of these, ``'@'`` is assumed. +.. note:: + + The number 1023 (``0x3ff`` in hexadecimal) has the following byte representations: + + * ``03 ff`` in big-endian (``>``) + * ``ff 03`` in little-endian (``<``) + + Python example: + + >>> import struct + >>> struct.pack('>h', 1023) + b'\x03\xff' + >>> struct.pack('