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.
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.
