#该模块可以把一个类型,如数字,转成固定长度的bytes类型
import struct
# res = struct.pack('i',12345)
# print(res,len(res),type(res))  #长度是4

res2 = struct.pack('i',12345111)
print(res2,len(res2),type(res2))  #长度也是4

unpack_res =struct.unpack('i',res2)
print(unpack_res)  #(12345111,)
# print(unpack_res[0]) #12345111

struct

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-05
猜你喜欢
  • 2021-12-08
  • 2021-06-05
  • 2021-09-25
  • 2022-12-23
相关资源
相似解决方案