Skip to content

Instantly share code, notes, and snippets.

@slackorama

slackorama/foobar.py

Created Jan 17, 2018
Embed
What would you like to do?
from lxml import objectify
tree = objectify.parse('/home/seth/Downloads/slackorama-2018-01-17-pettit-1-9725148.tcx')
root = tree.getroot()
namespaces = {'ns': 'http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2',
'ns3': 'http://www.garmin.com/xmlschemas/ActivityExtension/v2'}
for tp in root.xpath('//ns:Trackpoint', namespaces=namespaces):
print(tp.Time);
print(tp.xpath('.//ns:Extensions/ns3:TPX/ns3:Watts', namespaces=namespaces)[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment