I'm using xml.etree.ElementTree to parse an xml file in the form-
<element>
<status>OK</status>
<duration>
<value>340110</value>
<text>3 jours 22 heures</text>
</duration>
<distance>
<value>1734542</value>
<text>1 735 km</text>
</distance>
</element>
I am then separating out the time values and comparing them to get the smallest possible value. However, I'm not sure how to do this without also ending up getting the distance value, which messes up my dataset. This is the code I have so far for fetching anything under the values root-
import xml.etree.ElementTree as ET
times=[]
for i in htmlSource:
root=ET.fromstring(i)
for value in root.iter('value'):
times.append(value.text)
Is there a way I can modify this to only get the values under duration and not distance? Thank you in advance.