Some random BALRALGRH of python:
somelist = [[i, i**2, i**i] for i in xrange(25)] for setofthreenumbers in somelist: print setofthreenumbers, " Holy Guantanamo!"
And a quick python snippet that will return lat/long data given a search string. This assumes that you have a Bing maps account and an account key, and that you are using Django.
import urllib from django.utils import simplejson def get_lat_long(query): query = urllib.quote_plus(query) url ="http://dev.virtualearth.net/REST/v1/Locations?query=" + query + "&key=" + BINGKEY jsondata = simplejson.loads(urllib.urlopen(url).read()) #only want one result if len(jsondata['resourceSets'][0]['resources']) == 1: return jsondata['resourceSets'][0]['resources'][0]['point']['coordinates'] else: return None
No comments:
Post a Comment