Skip to main content

A simple conversion of an lxml.objectify element to a python dictionary.

Project description

A simple conversion of an lxml.objectify element to a python dictionary.

Usage

>>> from lxml_to_dict import lxml_to_dict
>>>
>>> lxml_to_dict(<the lxml.objectfy.Element>)
>>>
>>> root = objectify.Element("root")            # <root></root>
>>> b = objectify.SubElement(root, "b")         # <root><b></b></root>
>>> b = objectify.SubElement(root, "b")         # <root><b></b><b></b></root>
>>> a = objectify.SubElement(root, "a")         # <root><b></b><b></b><a></a></root>
>>> lxml_to_dict(root)                          # {'root': {'b': None, 'b1': None, 'a': None}}

Test

You can run the tests using tox

tox

Publish

To publish a new version of this package your Pypi user needt to be added to the project. (Ask Connor to give you access)

# Update version number in setup.py

python setup.py sdist
twine upload dist/*

Project details


Download files

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

Source Distribution

lxml_to_dict-0.1.0.tar.gz (1.9 kB view details)

Uploaded Source

File details

Details for the file lxml_to_dict-0.1.0.tar.gz.

File metadata

File hashes

Hashes for lxml_to_dict-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d1baebb2742adc17a2d2227707ecf8dc47c1164c2f108c7ff9e9ed43c35633c
MD5 6b5c918b37ccf4123ef8e7a8ee2f317e
BLAKE2b-256 e44d89769878b14c4e63a92f526b26f7df58d7ab4f20678ef629721b887aa9ab

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page