what the heck this code is doing?
Basant Dagar
dagar.basant2 at gmail.com
Fri Jul 1 14:00:03 EDT 2016
#See below code:
def lookup(d, keyval):
found = False
for child in d:
if found : return child.text
if child.tag == 'key' and child.text == keyval :
found = True
return None
trackID = lookup(entry, 'Track ID')
Below is the main part of input xml file data, it passes to lookup function:
<key>Track ID</key><integer>369</integer>
what I don't get is. How in the world it returns value 369 for the variable 'trackID'??
More information about the Python-list
mailing list