Open this example in the interactive library
Source code
import struct
raw = struct.pack('>Hh', 500, -3)
print(struct.unpack('>Hh', raw))Sample output
(500, -3)

Open this example in the interactive library
import struct
raw = struct.pack('>Hh', 500, -3)
print(struct.unpack('>Hh', raw))(500, -3)