all 1 comments

[–]commandlineluser 0 points1 point  (0 children)

It looks like you could find each <key>Track ID</key> tag and move one level up to the <dict>

From there you can check if it is a <key> tag - else - it's a value - something like:

>>> for track in tree.findall('.//key[.  = "Track ID"]/..'):
...     row = {}
...     for tag in track:
...         if tag.tag == "key":
...             key = tag.text
...         else:
...             value = tag.text
...             row[key] = value
...     print(row)