Skip to content

Instantly share code, notes, and snippets.

@maxvonhippel
Created February 4, 2017 18:23
Show Gist options
  • Save maxvonhippel/83db1d24fb701a1db0874cbc8b2f3dc3 to your computer and use it in GitHub Desktop.
Save maxvonhippel/83db1d24fb701a1db0874cbc8b2f3dc3 to your computer and use it in GitHub Desktop.
# -*- 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