我正在使用Python创建二进制解析器。
EOF error
但是,当数据文件上的字节仍然存在时,它给出了一个偶数。有没有人面临同样的问题?无论如何要克服这一点?
from btsv3 import Btsv3
import os
import binascii
import csv
for root, dirs, files in os.walk("./Perf/BTS/", topdown=False):
for name in files:
g = Btsv3.from_file(os.path.join(root, name))
if g.header.version == 3:
print(os.path.join(root, name), "Version 3")
# Header
print("BTS ID:", g.header.btsid, " | VERSION:", g.header.version, " | TOTAL LENGTH:", g.header.len, "\n")
# Payload
print("L3 perf data of BTS")
print("Payload tag:", g.payload.l3tag)
print("Payload length:", g.payload.l3len)