class MyHeader(ctypes.Structure):
    _fields_ = [('fieldA', ctypes.c_ubyte, 3), ('fieldB', ctypes.c_ubyte, 2
        ), ('fieldC', ctypes.c_ubyte, 3), ('fieldD', ctypes.c_ushort, 14),
        ('fieldE', ctypes.c_ubyte, 4)]
lib = ctypes.cdll.LoadLibrary('C/bitfield.dll')
Доступ к битовым полям при чтении/записи двоичных структур данных