What's the best way to convert XML to a dictionary in Python? or How can I efficiently parse XML into

20 Replies, 1799 Views

If you’re lazy (like me), xmltodict is the answer. One-liner conversion, and it handles most edge cases.

For attributes, it adds `@` prefixes, which is a bit weird but consistent.

Bonus: It also does dict to XML if you need to go backwards.

Messages In This Thread



Users browsing this thread: 1 Guest(s)