Utilities for building ElementTrees
Project description
Klon is a collection of utilities for building ElementTrees.
from klon import build_etree
etree = build_etree(
'html',
[
'head',
['title', 'Test Document'],
],
[
'body',
['h1#title', 'This is a test'],
['img', {'src': 'https://website.com/image'}],
]
)
Under the hood this just builds the tree using the standard xml.etree.ElementTree.Element()
If you change the import line instead to this:
from klon.lxml import build_etree
then you get a version with the same interface but that builds the tree using lxml.etree.Element()
instead (note that you don't
need LXML installed if you're not using klon.lxml
).
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
klon-1.0.0.tar.gz
(3.7 kB
view hashes)
Built Distribution
klon-1.0.0-py3-none-any.whl
(4.8 kB
view hashes)