Over the last weekend and a half I made this tiny website pythonstruct.com. It gives users a quick explanation of the format strings used in Python’s
struct module. You can paste in a string like
<hhl and get an instant explanation that the structure being packed/unpacked used is two
shorts and one
long with little-endian byte order.
This was motivated by me stumbling upon the use of this module in a codebase at work and having to look through the docs to decipher the format strings. A side benefit of writing this tool is that now I understand the
struct module better. The source code is at https://github.com/branislavjenco/struct-explainer/.
lib.js and the code for the various event handlers is in
main.js. There are also some unit tests that can be run using
node test, thanks to the fact that
main.js exports its functions both for the browser and