Friday, February 3, 2012

Python : struct.upack format data justification

Problem:
While reading data from a binary data file, when mixing data formats with different lengths (e.g. 'h' and 'f') python will assume the file has pad bytes that align all the data.

Solution
Use the '=' qualifier to prevent weird justification.

No comments:

Post a Comment