Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def _xml_to_dict(xmltree):
- '''
- Convery an XML tree into a dict
- '''
- xmldict = {}
- for item in xmltree:
- comps = item.tag.split('}')
- name = comps[1]
- if not name in xmldict.keys():
- if len(item.getchildren()) > 0:
- xmldict[name] = _xml_to_dict(item)
- else:
- xmldict[name] = item.text
- return xmldict
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement