Pack/unpack a 3 byte integer in Python with struct.pack

Viewed 355

I need to send a packet to a system, the problem is the specification states it must conform to the following:

Padding (set to zero) : 1 byte
Packet Length : 3 bytes

For the rest of the implementation, I have been using struct.pack() and struct.unpack(), but there isn't an option for a 3-byte integer.

Is there an easy way of achieving this?

0 Answers
Related