I need to send a message of bytes in Python and I need to convert an unsigned integer number to a byte array. How do you convert an integer value to an array of four bytes i
Sven has you answer. However, byte shifting numbers (as in your question) is also possible in Python:
>>> [hex(0x12345678 >> i & 0xff) for i in (24,16,8,0)] ['0x12', '0x34', '0x56', '0x78']