formats = {
(‘integer’, 2): ‘H’, # int of length 2 => format string ‘H’
(‘integer’, 4): ‘I’,
(‘integer’, 6): ‘6s’, # int of length 6 => parse as string, convert later
(‘integer’, 8): ‘Q’,
(‘alpha’, 1): ‘s’,
(‘alpha’, 2): ‘2s’,
(‘alpha’, 4): ‘4s’,
(‘alpha’, 8): ‘8s’,
(‘price_4’, 4): ‘I’,
(‘price_8’, 8): ‘Q’,
}
Can someone explain how each datatype bits/length correlates to the string Format?
Also is there a reason why 6 is 6s where its parsed as a string and converted later?