This is kind of an old thread, but in Python 3.2+ now you can simply say:
number = 100
number.to_bytes(4, byteorder="big")
or byteorder="little"
as per your needs. Documentation here.
This is kind of an old thread, but in Python 3.2+ now you can simply say:
number = 100
number.to_bytes(4, byteorder="big")
or byteorder="little"
as per your needs. Documentation here.