Last active
December 19, 2017 00:38
-
-
Save BlogBlocks/93860ae70bbc6262d85a45c16c99913c 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
| """ | |
| Example: IBM Boulder, CO | |
| Address or Place of Interest :IBM Boulder, CO | |
| Returned: | |
| 7 -- lat: 40.0893174, | |
| 8 -- lng: -105.1981258}, | |
| 80 -- formatted_address: | |
| 81 -- 6300 Diagonal Hwy, Boulder, CO 80301, USA | |
| 83 -- establishment | |
| 84 -- point_of_interest | |
| and More | |
| """ | |
| import urllib, json | |
| def readJ(address): | |
| url = "http://maps.googleapis.com/maps/api/geocode/json?address="+address+"" | |
| response = urllib.urlopen(url) | |
| data = json.loads(response.read()) | |
| count = 0 | |
| data = str(data) | |
| lines = data.split("u'") | |
| for line in lines: | |
| count = count +1 | |
| line = line.replace(" u'"," ");line = line.replace("{","\n") | |
| line = line.replace("', ","\n");line = line.replace("u'","") | |
| line = line.replace("':",":") | |
| if len(line) > 2: | |
| print count,"--",line | |
| if __name__ == '__main__': | |
| address = raw_input("Address or Place of Interest :") | |
| readJ(address) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
made public