The struct module is useful when you’re trying to convert data to and from binary formats. However, recently I came across a file format specification that uses the binary16 floating point format. I looked through the Python documentation, but can’t find anything that can convert to and from it. What would be the best way to convert this data to/from Python floats?
The struct module is useful when you’re trying to convert data to and from
Share
You can do it roughly like you’d do it in C — i.e., I think, roughly like this…: