Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cuducos/brazilian-cities
A script to generate list with all Brazilian cities and states
https://github.com/cuducos/brazilian-cities
hacktoberfest
Last synced: about 2 months ago
JSON representation
A script to generate list with all Brazilian cities and states
- Host: GitHub
- URL: https://github.com/cuducos/brazilian-cities
- Owner: cuducos
- License: unlicense
- Created: 2016-11-15T19:35:50.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2022-03-08T03:45:40.000Z (almost 3 years ago)
- Last Synced: 2024-08-01T22:55:51.091Z (4 months ago)
- Topics: hacktoberfest
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 48
- Watchers: 4
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- starred-awesome - brazilian-cities - A script to generate list with all Brazilian cities and states (Python)
README
# Load Brazilian cities and states from IBGE
This is a simple script to build a list of Brazilian cities and states from [IBGE](http://www.ibge.gov.br/english/) (using [Cidades](http://cidades.ibge.gov.br/) portal).
## Usage
This script requires [Python 3.5](https://python.org) 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
```csv
code,name,state
520005,Abadia de Goiás,GO
310010,Abadia dos Dourados,MG
520010,Abadiânia,GO
…
```#### States
```csv
code,abbr,name
12,AC,Acre
27,AL,Alagoas
16,AP,Amapá
…
```### JSON
#### Cities
```json
[
{
"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
```json
[
{
"name": "Acre",
"abbr": "AC",
"code": "12"
},
{
"name": "Alagoas",
"abbr": "AL",
"code": "27"
},
{
"name": "Amapá",
"abbr": "AP",
"code": "16"
},
…
]
```