Created
February 4, 2017 18:23
-
-
Save maxvonhippel/83db1d24fb701a1db0874cbc8b2f3dc3 to your computer and use it in GitHub Desktop.
This file contains 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
# -*- coding: utf-8 -*- | |
import urllib | |
import json | |
from pprint import pprint | |
# get the web page | |
url = 'https://www.rally-maps.com/Rallye-Monte-Carlo-2017/Agnières-en-Dévoluy-Le-Motty#ElevationChart' | |
f = urllib.urlopen(url) | |
# find the relevant line | |
for line in f: | |
if 'elevationData:' in line: | |
csvline = line[22:-3] | |
for item in csvline.split("},"): | |
# print("item: " + item[1:-1]) | |
components = item[1:-1].split(',') | |
lng = components[0].split(':')[1] | |
lat = components[1].split(':')[1] | |
ele = components[2].split(':')[1] | |
print("lng: " + lng + " lat: " + lat + " ele: " + ele + "\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment