Just a test repository.

first commit

nys f04ee5e1

Changed files
+20
README.md

This is a binary file and will not be displayed.

+20
binary_file.py
··· 1 + import struct 2 + import os 3 + 4 + DATA_FORMAT = 'i10sf' 5 + 6 + f = open("data.bin", 'rb'); 7 + 8 + raw_data = f.read(struct.calcsize(DATA_FORMAT)); 9 + 10 + unpacked_data = struct.unpack(DATA_FORMAT, raw_data); 11 + 12 + id = unpacked_data[0]; 13 + name = unpacked_data[1]; 14 + age = unpacked_data[2]; 15 + 16 + name = name.decode('utf-8').strip('\x00') 17 + 18 + print(f"id: {id}"); 19 + print(f"name: {name}"); 20 + print(f"age: {age:}");