读二进制文件
size = 1280*720*3
file_name = r'D:raw.dat'
with open(file_name, 'rb') as f:
data = f.read(size)
数字转byte
count_bytes = count.to_bytes(2, byteorder='little') seq_bytes = seq.to_bytes(4, byteorder='big') for i in range(count): index_bytes = i.to_bytes(2, byteorder='little') print(b'x00x00x00x8b', seq_bytes) print(b'x29x00', index_bytes ) print(b'x55x00', total_bytes)
同时用C语言写的,c语言的数字转byte:
htons(total); htons(index); htonl(seq);暑期编程PK赛 得CSDN机械键盘等精美礼品!



