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

20 Replies, 1586 Views

Try `untangle` if you want something even simpler than xmltodict. It turns XML into Python objects, which you can then convert to dict.

Not as popular, but super easy for small projects.

---

Wow, didn’t expect so many replies!

Tried xmltodict based on the suggestions, and it’s way cleaner than what I was doing. The `@attribute` thing is a lifesaver.

Still running into issues with super nested stuff—anyone got tips for handling super deep XML? Maybe a recursion example?

Also, big thanks for the `lxml` and `untangle` mentions—gonna check those out next.

Messages In This Thread



Users browsing this thread: 1 Guest(s)