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.1.tar.gz (10.2 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.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: commondata_countries-2.1.1.tar.gz
  • Upload date:
  • Size: 10.2 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.1.tar.gz
Algorithm Hash digest
SHA256 edbff07c33f5992662f0862b0d6d61dab8e4cd42be39f6aedba35a99c45a16ca
MD5 51d21aaefc7667476fdf74cea0b7900c
BLAKE2b-256 e12a6185e1573140b97da6fe2006f6e95f5259f8cb3584690acf4550a4fe6305

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for commondata_countries-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c89aa4ce63d18f36b4018b32b5ddfce2ac42a4abc6aa3fe01e7d3d76e9635ca
MD5 97de6805f4701c8bfce79bc975e492b2
BLAKE2b-256 eb808b26f69779b65b4ea7069cefe884d01302751455d5bb9b27e80e946362d1

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