I'm trying to convert an int to bytes, but trying to convert under 4 bytes raises OverflowError.
(我正在尝试将int转换为字节,但是尝试将其转换为4个字节以下会引发OverflowError。)
What is the reason for this? (这是什么原因呢?)
a = 6901571584
a.to_bytes(1, byteorder=sys.byteorder)
# OverflowError: int too big to convert
edit: For 5 bytes it returns b'\x00\xa0]\x9b\x01'
(编辑:对于5个字节,它返回b'\x00\xa0]\x9b\x01'
)
ask by Zerg Overmind translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…