import os
fd = open("./xxx.bin","r")
mystr = fd.read()
len1 = len(mystr)
Hex_Str = ""
offset = 0
for i in range(0, len1,1):
Hex_Str += "0x"+(hex(ord(mystr[i])).replace('0x','').zfill(2)).upper()+ ","
offset += 1
if offset == 16:
print Hex_Str
Hex_Str = ""
offset = 0
print Hex_Str
fd.close()
bin 文件转 hex 数组
最新推荐文章于 2024-07-22 03:28:29 发布