Examples of use of the python struct

import struct

i = 1024
# s0为一个字符串,长度为4,即占四个字节,这样方便传输与保存二进制数据。
s0 = struct.pack(">I", i)
print(s0)
i2 = struct.unpack(">I",s0)
print(i2)

Guess you like

Origin www.cnblogs.com/c-x-a/p/11022520.html