Python: Loop through all nested key-value pairs created by xmltodict
问题 Getting a specific value based on the layout of an xml-file is pretty straight forward. (See: StackOverflow) But when I don't know the xml-elements, I can't recurse over it. Since xmltodoc nests OrderedDicts in OrderedDicts. These nested OrderedDicts are typified by Python as type: 'unicode'. And not (still) as OrderedDicts. Therefor looping over like this, doens't work: def myprint(d): for k, v in d.iteritems(): if isinstance(v, list): myprint(v) else: print "Key :{0}, Value: {1}".format(k,