stchris / untangle

Converts XML to Python objects
MIT License
611 stars 83 forks source link
pypi python xml

untangle

Build Status PyPi version Code style: black

Documentation

Installation

With pip:

pip install untangle

With conda:

conda install -c conda-forge untangle

Conda feedstock maintained by @htenkanen. Issues and questions about conda-forge packaging / installation can be done here.

Usage

(See and run examples.py or this blog post: Read XML painlessly for more info)

import untangle
obj = untangle.parse(resource)

resource can be:

Running the above code and passing this XML:

<?xml version="1.0"?>
<root>
    <child name="child1"/>
</root>

allows it to be navigated from the untangled object like this:

obj.root.child['name'] # u'child1'

Changelog

see CHANGELOG.md