Skip to main content

Parse struct definitions like those used in the struct module

Project description


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).


.. 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.


This library supports only Python 3.

.. _struct:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for struct-parse, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size struct_parse-0.0.2-py3-none-any.whl (4.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size struct_parse-0.0.2.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page