This is the function I\'m after: -
http://docs.python.org/3/library/stdtypes.html#int.to_bytes
I need big endianness support.
You can probably use struct.pack instead:
>>> import struct >>> struct.pack('>i', 123) '\x00\x00\x00{'
It doesn't do arbitrary lengths in the way int.to_bytes does, but I doubt you need that.
int.to_bytes