Skip to main content

A Python package for managing country data.

Project description

commondata-countries

A Python package for managing country data.

Installation

pip install commondata-countries

Usage

Iterate over all countries:

from commondata_countries import CountryData

countries = CountryData()

for country in countries:
    print(country.name)

List all countries:

from commondata_countries import CountryData

countries = CountryData()

print(countries.all())

Lookup a country

from commondata_countries import CountryData

countries = CountryData()

# Lookup by name (case insensitive, fuzzy search)
country = countries["Untied States of America"]

# Lookup by ISO Alpha-2
country = countries["US"]

# Lookup by ISO Alpha-3
country = countries["USA"]

# Lookup by ISO Numeric
country = countries[840]

print(country)
> Country(name='United States of America', iso_alpha2='US', iso_alpha3='USA', iso_numeric=840)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

commondata_countries-1.1.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

commondata_countries-1.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file commondata_countries-1.1.0.tar.gz.

File metadata

  • Download URL: commondata_countries-1.1.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.2 Darwin/24.3.0

File hashes

Hashes for commondata_countries-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e0f575e0e99cd5067af7f9c5abd5636ecb02bd3a9b0be5bd3a4f635d68fd2a12
MD5 cc40589c5160f474cc2d0ad087a69d54
BLAKE2b-256 a6f73cfc5cb78bea7f8a04f0c46f0bbd1b34f30b01ecfba5c69a07836c632b1f

See more details on using hashes here.

File details

Details for the file commondata_countries-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for commondata_countries-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 124b611299d4c2d2751ed92d5912317ecc6256d326747eb50eb97e30590b95a0
MD5 972d52038e025f3cc7f949b81d6ada06
BLAKE2b-256 e3ac894230711c9a27ddefccdd24e59636326594fc88c85e11562f1fe5b09232

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page