import binascii
# 读取二进制文本并显示为16进制
def readBinfile(binFile_path:str):
for i in range(16):
print("%02x".upper() % i, end=' ')
print()
with open(binFile_path, 'rb') as f:
num = 0
while 1:
a = f.read(1)
if not a:
break
if num % 16 == 0:
print()
hexstr = binascii.b2a_hex(a)
print(hexstr.decode().upper(), end=' ')
num += 1
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)