python 工具 二进制文件处理之——去掉指定长度数据包头

python

包头48bit 数据98464 。。。如此循环:

 

piece_size = 48

piece_size1 = 98464

with open("C:\\Users\\Administrator\\Desktop\\bins\\234.bin", "rb") as in_file, open("C:\\Users\\Administrator\\Desktop\\bins\\234_deal.bin", "ab+") as out_file:

while True:

piece = in_file.read(piece_size)

piece1= in_file.read(piece_size1)

if not piece:

break

if not piece1:

break

out_file.write(piece1)

in_file.close()

out_file.close()

# f = open("C:\\Users\\Administrator\\Desktop\\bins\\OUT4.TXT", \'rb\')

# while True:

# block = f.read(1024)

# print(block)

# if not block:

# break

# f.close()

 

以上是 python 工具 二进制文件处理之——去掉指定长度数据包头 的全部内容, 来源链接: utcz.com/z/388287.html

回到顶部