Convert XML to dictionary in Python using lxml
Personally I like xmltodict
from here. With pip you can install it like so pip install xmltodict
.
Note that this actually creates OrderedDict
objects. Example usage:
import xmltodict as xd
with open('test.xml','r') as f:
d = xd.parse(f)