import struct path = "/home/aria/kellogg_remake/raw/PCKELL.DAT" data = open(path, "rb").read() # look at region from 580 to 900, print as hex with offsets start = 580 end = 900 for i in range(start, end, 16): chunk = data[i:i+16] hexs = ' '.join(f'{b:02x}' for b in chunk) print(f'{i:06x}: {hexs}')