class BinaryHeader(BigEndianStructure):
    _fields_ = [('sequence_number_4bytes', c_uint), ('ascii_text_32bytes', 
        c_char * 32), ('timestamp_4bytes', c_uint), (
        'more_funky_numbers_7bytes', c_byte * 7), ('some_flags_1byte',
        c_byte), ('other_flags_1byte', c_byte), ('payload_length_2bytes',
        c_ushort)]
mystruct = BinaryHeader(286331153, '"' * 32, 858993459, (c_byte * 7)(*([68] *
    7)), 85, 102, 30583)
print(sizeof(mystruct))
with open('data.txt', 'wb') as f:
    f.write(mystruct)
Разбор двоичных данных в объект структуры ctypes через readinto()