First of all, I want to say I am using a creative commons image with this post, it is from Christian Frausto Bernal go check his pictures, they are pretty good.
Ok, so today I needed to get the mexican states and municipalities to use in some Plone dictionaries, so I got that from the SEPOMEX site.
I processed it a little and I got a very simple python file.
I has two dictionaries, the first one called states has a dictionary of normalized id’s and names, for example:
from states import states print states['distrito_federal'] |
and you’ll get something like:
Distrito Federal
The other dictionary is the one with the municipalities, you can use it like this:
from states import data print data['distrito_federal']['miguel_hidalgo'] |
And you should get something like Miguel Hidalgo.
Of your you can traverse it with something like:
for m in data['distrito_federal'].keys(): print m |
That way you can get every municipality key.
And of course you know.. it’s python and it should be pretty simple to convert it to mysql, csv, or another format you might be using..
So have fun!
If you think that might be helpful you can download it here:

Heya i got to your site by mistake when i was searching bing for something off topic here but i do have say your site is really helpful, like the theme and the content on here…so thanks for me procrastinating from my previous task, lol