Created
April 8, 2015 09:24
-
-
Save simos/011ac5a3e7f70397f3af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
FILENAME="Lesvos Birdings map of birding sites-Steve Dudley.gpx" | |
from lxml import etree | |
tree = etree.parse(FILENAME) | |
root = tree.getroot() | |
for wpt in tree.xpath('//wpt'): | |
name = None | |
desc = None | |
cmt = None | |
for child in wpt: | |
if (child.tag == 'name'): | |
name = child | |
elif (child.tag == 'desc'): | |
desc = child | |
elif (child.tag == 'cmt'): | |
cmt = child | |
name.text += ': ' | |
name.text += desc.text | |
print (etree.tostring(root, pretty_print=True)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment