Created
August 5, 2015 11:10
-
-
Save bergman/2f9cdfe052be9bf061e6 to your computer and use it in GitHub Desktop.
region code to region name
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
# curl -O "http://www.maxmind.com/download/geoip/misc/region_codes.csv" | |
import csv | |
region_lookup = {} | |
with open("region_codes.csv", "rb") as f: | |
reader = csv.reader(f, delimiter=",") | |
for i, row in enumerate(reader): | |
region_lookup[(row[0], row[1])] = row[2] | |
print "(US, CA): %s" % region_lookup[("US", "CA")] | |
print "(SE, 21): %s" % region_lookup[("SE", "21")] | |
print "(SE, 26): %s" % region_lookup[("SE", "26")] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment