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
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 unpack packed 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.
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
struct_parse-0.0.1.tar.gz
(3.3 kB
view hashes)
Built Distributions
struct_parse-0.0.1-py3.7.egg
(4.4 kB
view hashes)
Close
Hashes for struct_parse-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab525f1fed48ebbe6eae02a49043a3891419d0febf1ca7843c87e95bbdfa112b |
|
MD5 | 50b888d9a3a3f6df2a021a3e4a38d5bd |
|
BLAKE2b-256 | 82625f842758dc0982215ff50b44d5ec882780ac0ac87d2f94574f902b1acd3f |