Objective
Binary record files store each field in a fixed size. struct converts Python values to bytes and back according to a format.
Instructions
- The first line has the number
nof records; each one is a linename age score(name of up to 10 ASCII letters, age from 0 to 255 and score from 0 to 65535). - Save the records in
registros.binwith the format"<10sBH"(little-endian: 10-byte text, one byte and an unsigned 2-byte integer). ShowRecord size: 13and then read the file record by record and showname age scoreper line (the name without the null padding bytes).
2
ana 30 950
luis 7 65535
Record size: 13
ana 30 950
luis 7 65535
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise