Country-Capitals
Get the name of a country's capital city. That's pretty much it.
Installation
pip install country_capitals
Usage
You can lookup capitals by country name, code, or ISO numbers. Including fuzzy=True will try to use use a fuzzy matching algorithm to find the country name.
from country_capitals import get_capital
get_capital("Germany")
get_capital("Germ", fuzzy=True)
get_capital("DEU")
get_capital("DE")
get_capital("276")
For ISO 3166-1 codes specifically, you can use get_capital_by_iso_code or any of the more specific functions:
from country_capitals import get_capital_by_iso_code, get_capital_by_numeric, get_capital_by_alpha2, get_capital_by_alpha3
get_capital_by_iso_code("DE")
get_capital_by_iso_code("DEU")
get_capital_by_iso_code("276")
# or
get_capital_by_alpha2("DE")
get_capital_by_alpha3("DEU")
get_capital_by_numeric("276")
Development
Run the tests:
python -m unittest
Build the package:
python -m build
Metadata
Release files for country-capitals 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| country_capitals-1.0.1.tar.gz | 7.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| country_capitals-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.1 kB
Release files / country_capitals-1.0.1.tar.gz
| Download URL | country_capitals-1.0.1.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea76b17017ec6b0fd59d211666e538302e93ffaa03f02965fed163bd1fcca83d
|
|
BLAKE2b-256 checksum How to use checksums |
abbfadbfdb42b4c3509f337278774de9726315abc0120cf71e567f319b1f62a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.8
|
Release files / country_capitals-1.0.1-py3-none-any.whl
| Download URL | country_capitals-1.0.1-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
779b5ec94411ea30c0ac9dce18acb2744888522390e49b33d8b4d2d5268b048c
|
|
BLAKE2b-256 checksum How to use checksums |
40a74e056ea4c635dae9d3c4ad10bcdadca02cca19d064998766d97d37ef4aa0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.8
|