Skip to main content

Work with ISO 3166-1 alpha2, alpha3 and numeric standard country data

Project description

commondata-countries

Work with ISO 3166-1 alpha2, alpha3 and numeric standard 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-2.1.0.tar.gz (9.6 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-2.1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: commondata_countries-2.1.0.tar.gz
  • Upload date:
  • Size: 9.6 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-2.1.0.tar.gz
Algorithm Hash digest
SHA256 276de330c0020c17caed1d57c33f75305610133ec90402c21533bafc3e3a7d2b
MD5 06e6ea4fa352827407b4edba1677133f
BLAKE2b-256 49c96ae987501e33d7e2679258e4a04c629ee3c46bc24d17b69ae558249376f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for commondata_countries-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a97e0d56fbeee04625e609a15d552a036a6f7e490ef86e2a3a6ec4244b495ce9
MD5 e3dd62be294a50b4df21804db7c9aac0
BLAKE2b-256 e8fef0e3c8d150c87d6103c6197836f1764447e8921b4ace05bcda696c0250a8

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