Skip to main content

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

Project description

Build Status

lxml to dict

Package on Pypi

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 needs 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.2.tar.gz (2.1 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: lxml_to_dict-0.1.2.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.5.2

File hashes

Hashes for lxml_to_dict-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a4fc9eab30614834e85b3a8eccbe19effccbbd09d9377989cb3d63a29808023e
MD5 bd1bcf2eb8703140a42f48e783a83922
BLAKE2b-256 d8aefa93a5ce28a721f975997567d3327e60a2513122b4c5b53ef06c452c0f7c

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