Steven D'Aprano added the comment:
The behaviour is correct. You have tripped over the ASCII representation of
bytes. In ASCII, 119 (or in hex, 0x77) is displayed as 'w'.
>>> b'\x77\x00\x00\x00'
b'w\x00\x00\x00'
--
nosy: +steven.daprano
resolution: -> not a bug
stage: -> resolved
s
New submission from Terje Myklebust :
>>> struct.pack("i", 119)
b'w\x00\x00\x00'
"w" in a binary value?
>>> struct.pack("I", 116)
b't\x00\x00\x00'
"t" in a binary value?
--
messages: 406150
nosy: terje.myklebust123
priority: normal
severity: normal
status: open
title: Bug in struct