On 2019-09-08 20:58, Eko palypse wrote:
I'm confused about the following
import sys
print(tuple(bytes.fromhex('282C34')))
print(tuple((0x282C34).to_bytes(3, byteorder=sys.byteorder)))
which results in
(40, 44, 52)
(52, 44, 40)
on my machine. Shouldn't I expect the same result?
You haven't said whether your machine is big-endian or little-endian.
On a little-endian machine a 4-byte integer 0x282C34 is stored as:
34 2C 28 00
-> increasing address ->
On a big-endian machine a 4-byte integer 0x282C34 is stored as:
00 28 2C 34
-> increasing address ->
--
https://mail.python.org/mailman/listinfo/python-list