Parse struct definitions like those used in the struct module
Project description
struct-parse
struct_parse
builds on the struct_ module in the standard library.
struct
lets you parse buffers by describing the format similarly to C struct
definitions. struct_parse
aims to comply with the struct
module's format
strings, but instead returns a (very flat) abstract syntax tree (AST).
Example
.. code-block:: python
import struct_parse
field_list = struct_parse.parse('hhl') print(field_list.fields)
This will print::
[<FieldType.FLOAT: 16>, <FieldType.FLOAT: 16>, <FieldType.LONG: 9>]
Use cases
For simply unpacking packed binary data, the struct
module does the trick.
The goal of this module is to enable the user to do other stuff with the format
string--we return a sequence of types instead of a sequence of values.
Compatibility
This library supports only Python 3.
.. _struct: https://docs.python.org/3/library/struct.html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for struct_parse-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fa2043a222734929afa22b31ffa350ac44b1132eec1254302b9765dfef19dee |
|
MD5 | 1f81b1c0588a29db9dea85904c1a151a |
|
BLAKE2b-256 | 6817f89d87fde91d382ef5d0ede347dff0e44f43a783ac46837a83d00c7e16bd |