Get the name of a country's capital city.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file country_capitals-1.0.1.tar.gz.
File metadata
- Download URL: country_capitals-1.0.1.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea76b17017ec6b0fd59d211666e538302e93ffaa03f02965fed163bd1fcca83d
|
|
| MD5 |
3aeaa81e610407fbd25686cd64f808c0
|
|
| BLAKE2b-256 |
abbfadbfdb42b4c3509f337278774de9726315abc0120cf71e567f319b1f62a3
|
File details
Details for the file country_capitals-1.0.1-py3-none-any.whl.
File metadata
- Download URL: country_capitals-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
779b5ec94411ea30c0ac9dce18acb2744888522390e49b33d8b4d2d5268b048c
|
|
| MD5 |
690a450cb8fd34941de78f37bf0b2506
|
|
| BLAKE2b-256 |
40a74e056ea4c635dae9d3c4ad10bcdadca02cca19d064998766d97d37ef4aa0
|