is there a Python equivalent to Perl's XML::Simple?
You know, something that takes an xml input file and returns a dict, creating keys based on the tag names, and nesting a list of dict's for all the children of each node? If you are familiar with Perl's XML::Simple -- I'm looking for the Python equivalent of that.
I'm tooling around with xml.etree.ElementTree and that will get the job done. But initially I wa开发者_C百科s searching for something that can suck the XML data into a Python dict that I can traverse knowing the tag names.
Aside: Don't bother yelling at me for serializing config data with XML, I already know. If it were up to me, I'd change the format to YAML or JSON. But alas, this legacy system has XML files that I must parse for config data.
Try Beautiful Soup as described in question Editing XML as a dictionary in python?
how about python-simplexml ?
精彩评论