jeffersfp / brazilian-cities

A script to generate list with all Brazilian cities and states

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Load Brazilian cities and states from IBGE

This is a simple script to build a list of Brazilian cities and states from IBGE (using Cidades portal).

Usage

This script requires Python 3.5 or newer, and no external dependencies.

Run $ python cities.py and you'll have 4 new files: cities.csv, cities.json, states.csv and states.json.

File formats

CSV

Cities

code,name,state
520005,Abadia de Goiás,GO
310010,Abadia dos Dourados,MG
520010,Abadiânia,GO
…

States

code,abbr,name
12,AC,Acre
27,AL,Alagoas
16,AP,Amapá
…

JSON

Cities

[
  {
    "name": "Abadia de Goiás",
    "code": "520005",
    "state": "GO"
  },
  {
    "name": "Abadia dos Dourados",
    "code": "310010",
    "state": "MG"
  },
  {
    "name": "Abadiânia",
    "code": "520010",
    "state": "GO"
  },
  
]

States

[
  {
    "name": "Acre",
    "abbr": "AC",
    "code": "12"
  },
  {
    "name": "Alagoas",
    "abbr": "AL",
    "code": "27"
  },
  {
    "name": "Amapá",
    "abbr": "AP",
    "code": "16"
  },
  
]

About

A script to generate list with all Brazilian cities and states

License:The Unlicense


Languages

Language:Python 100.0%