Registry / productivity / country-list

country-list

JSON →
library1.1.0pypypi✓ verified 81d ago

Provides a comprehensive list of countries with names and ISO 3166-1 codes in all languages. Version 1.1.0 supports Python >=3.8,<4.0. Low cadence.

pip install country-list
INSTALL
IMPORT
SIG · COUNTRY-LIST
C
country-list
productivitypythonv1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

countries_for_language
from country_list import countries_for_language
from country_list import countries
country_list
from country_list import country_list
available_languages
from country_list import available_languages

Fetches country names and ISO codes for a given language code (e.g., 'en'). Returns a list of tuples (code, name).

from country_list import countries_for_language # Get countries in English countries_en = countries_for_language('en') for code, name in countries_en: print(code, name) break # just show one
Debug
Known issues
deprecatedThe function `countries()` (without language) is deprecated and may be removed. Use `countries_for_language()` instead.
fix
Replace `countries()` with `countries_for_language('en')` or any desired language code.
affects: >=1.0.0
gotchaLanguage codes are expected in ISO 639-1 two-letter format (e.g., 'en', 'fr') but the library does not validate them. Invalid codes return an empty list silently.
fix
Always use valid ISO 639-1 codes. Refer to pycountry or a standard list.
affects: all
gotchaThe order of countries in the returned list is arbitrary and not alphabetical.
fix
Sort the list manually if order matters: sorted(countries_for_language('en'), key=lambda x: x[1])
affects: all
Upgrade
Version history
1.1.0latest on PyPI · released Nov 5, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
29 hits · last 30 days
node
28
OpenAI (training)
1
Resources
country-list — pip install country-list · libregistry