import struct
FMT = "<10sih" # little-endian: 10-byte str, 4-byte int, 2-byte int
SIZE = struct.calcsize(FMT) # 16
roster = [("Amara", 12, 7), ("Ben", 8, 19), ("Chloé", 15, 4)]
with open("roster.dat", "wb") as f:
for name, goals, number in roster:
f.write(struct.pack(FMT, name.encode("utf-8"), goals, number))
with open("roster.dat", "rb") as f:
f.seek(2 * SIZE) # jump to record 2
raw_name, goals, number = struct.unpack(FMT, f.read(SIZE))
name = raw_name.rstrip(b"\0").decode("utf-8")
print(SIZE, name, goals, number)