🌐
PyPI
pypi.org › project › pycountry
pycountry · PyPI
ISO country, subdivision, language, currency and script definitions and their translations
      » pip install pycountry
    
Published   Feb 17, 2026
Version   26.2.16
🌐
GitHub
github.com › flyingcircusio › pycountry › issues › 148
UN registers 'Türkiye' as new country name to replace 'Turkey' · Issue #148 · pycountry/pycountry
November 7, 2022 - pycountry / pycountry Public · ... issueCopy link · New issueCopy link · Closed · Closed · UN registers 'Türkiye' as new country name to replace 'Turkey'#148 ·...
Author   pycountry
🌐
Kaggle
kaggle.com › code › ttahara › fsq-lm-get-country-name-by-pycountry
FSQ-LM: Get Country Name by pycountry
Checking your browser before accessing www.kaggle.com · Click here if you are not automatically redirected after 5 seconds
🌐
PyPI
pypi.org › project › country-converter
country-converter · PyPI
import country_converter as coco cc = coco.CountryConverter() some_countries = ['Australia', 'Belgium', 'Brazil', 'Bulgaria', 'Cyprus', 'Czech Republic', 'Denmark', 'Estonia', 'Finland', 'France', 'Germany', 'Greece', 'Hungary', 'India', 'Indonesia', 'Ireland', 'Italy', 'Japan', 'Latvia', 'Lithuania', 'Luxembourg', 'Malta', 'Romania', 'Russia', 'Turkey', 'United Kingdom', 'United States'] oecd_since_1995 = cc.data[(cc.data.OECD >= 1995) & cc.data.name_short.isin(some_countries)].name_short eu_until_1980 = cc.data[(cc.data.EU <= 1980) & cc.data.name_short.isin(some_countries)].name_short print(oecd_since_1995) print(eu_until_1980)
      » pip install country-converter
    
Published   Oct 22, 2025
Version   1.3.2
🌐
Medium
medium.com › @HeCanThink › pycountry-your-passport-to-iso-country-codes-names-and-more-2c39ef6668c0
PyCountry: Your Passport to ISO Country Codes, Names and More 🛂 | by Manoj Das | Medium
August 11, 2023 - PyCountry is a Python library that provides functionalities related to ISO country codes and other country-related data.
🌐
GitHub
github.com › pycountry › pycountry › issues › 25
some countries not detected · Issue #25 · pycountry/pycountry
March 28, 2020 - Thank you for the great project!!! Following countries are not detected with pycountry.countries.search_fuzzy(...) W. Sahara Dem. Rep. Congo Dominican Rep. Falkland Is. Fr. S. Antarctic Lands Centr...
Author   pycountry
🌐
Readthedocs
nomenclature-iamc.readthedocs.io › en › v0.28.1 › _modules › nomenclature › countries.html
nomenclature.countries — nomenclature 0.28.1 documentation
import os import logging import ... "Venezuela", "Palestine, State of": "Palestine", "Taiwan, Province of China": "Taiwan", "Türkiye": "Turkey", # revert change in pycountry on Sep 29, 2023 "Virgin Islands, British": "British Virgin Islands", "Virgin Islands, U.S.": "United ...
🌐
GitHub
github.com › pycountry › pycountry › issues › 236
Problem with Turkey · Issue #236 · pycountry/pycountry
July 16, 2024 - Hi, Turkey name is in original language and not in english: "alpha_2": "TR", "alpha_3": "TUR", "flag": "🇹🇷", "name": "Türkiye", "numeric": "792", "official_name": "Republic of Türkiye" So, when I'm searching "Turkey" I get a None.
Author   pycountry
Find elsewhere
🌐
FreshPorts
freshports.org › devel › py-country
FreshPorts -- devel/py-country: Python API for ISO country, subdivision, language and currency
pycountry provides the ISO databases for the standards: -- 639: Languages -- 3166: Countries -- 3166-2: Subdivisions of countries -- 4217: Currencies -- 15924: Scripts The package includes a copy from Debian's pkg-isocodes and makes the data accessible through a Python API.
🌐
Parseltongue
parseltongue.co.in › exploring-countries-with-the-pycountry-module-in-python
ParselTongue - Exploring Countries with the pycountry Module in Python
September 1, 2023 - import pycountry country_name = "India" country = pycountry.countries.get(name=country_name) print(country)
🌐
Messageix
docs.messageix.org › projects › models › en › latest › _modules › message_ix_models › util › pycountry.html
message_ix_models.util.pycountry — message-ix-models documentation
#: #: Other code **may** extend this mapping before calling :func:`iso_3166_alpha_3`. COUNTRY_NAME = { "Cape Verde": "Cabo Verde", "Korea": "Korea, Republic of", "Libyan Arab Jamahiriya": "Libya", "Macedonia, the former Yugoslav Republic of": "North Macedonia", "Palestinian Territory, Occupied": "Palestine, State of", "Republic of Korea": "Korea, Republic of", "Russia": "Russian Federation", "South Korea": "Korea, Republic of", "Turkey": "Türkiye", } [docs] @lru_cache(maxsize=2**9) def iso_3166_alpha_3(name: str) -> str | None: """Return an ISO 3166 alpha-3 code for a country `name`. Parameters ---------- name : str Country name. This is looked up in the `pycountry <https://pypi.org/project/pycountry/#countries-iso-3166>`_ 'name', 'official_name', or 'common_name' field.
Top answer
1 of 9
13

I know this has been asked 8 months ago, but here is a pretty good solution in case you are coming from Google (just like me).

You can use the ISO standard library located here: https://pypi.python.org/pypi/iso3166/

This piece of code is taken from that link in case you get a 404 Error some time in the future:

Installation:

pip install iso3166

Country Details:

>>> from iso3166 import countries
>>> countries.get('us')
Country(name=u'United States', alpha2='US', alpha3='USA', numeric='840')
>>> countries.get('ala')
Country(name=u'\xc5land Islands', alpha2='AX', alpha3='ALA', numeric='248')
>>> countries.get(8)
Country(name=u'Albania', alpha2='AL', alpha3='ALB', numeric='008')

Countries List:

>>> from iso3166 import countries
>>> for c in countries:
>>>       print(c)
Country(name=u'Afghanistan', alpha2='AF', alpha3='AFG', numeric='004')
Country(name=u'\xc5land Islands', alpha2='AX', alpha3='ALA', numeric='248')
Country(name=u'Albania', alpha2='AL', alpha3='ALB', numeric='008')
Country(name=u'Algeria', alpha2='DZ', alpha3='DZA', numeric='012')
...

This package is compliant in case you want to follow the standardization proposed by ISO. According to Wikipedia:

ISO 3166 is a standard published by the International Organization for Standardization (ISO) that defines codes for the names of countries, dependent territories, special areas of geographical interest, and their principal subdivisions (e.g., provinces or states). The official name of the standard is Codes for the representation of names of countries and their subdivisions.

Hence, I strongly recommend using this library in all your apps in case you are working with Countries.

Hope this piece of data is useful for the community!

2 of 9
12

You can use pycountry to get a list of all the countries:

pip install pycountry 

Or you can use this dictionary:

Country = [
    ('US', 'United States'),
    ('AF', 'Afghanistan'),
    ('AL', 'Albania'),
    ('DZ', 'Algeria'),
    ('AS', 'American Samoa'),
    ('AD', 'Andorra'),
    ('AO', 'Angola'),
    ('AI', 'Anguilla'),
    ('AQ', 'Antarctica'),
    ('AG', 'Antigua And Barbuda'),
    ('AR', 'Argentina'),
    ('AM', 'Armenia'),
    ('AW', 'Aruba'),
    ('AU', 'Australia'),
    ('AT', 'Austria'),
    ('AZ', 'Azerbaijan'),
    ('BS', 'Bahamas'),
    ('BH', 'Bahrain'),
    ('BD', 'Bangladesh'),
    ('BB', 'Barbados'),
    ('BY', 'Belarus'),
    ('BE', 'Belgium'),
    ('BZ', 'Belize'),
    ('BJ', 'Benin'),
    ('BM', 'Bermuda'),
    ('BT', 'Bhutan'),
    ('BO', 'Bolivia'),
    ('BA', 'Bosnia And Herzegowina'),
    ('BW', 'Botswana'),
    ('BV', 'Bouvet Island'),
    ('BR', 'Brazil'),
    ('BN', 'Brunei Darussalam'),
    ('BG', 'Bulgaria'),
    ('BF', 'Burkina Faso'),
    ('BI', 'Burundi'),
    ('KH', 'Cambodia'),
    ('CM', 'Cameroon'),
    ('CA', 'Canada'),
    ('CV', 'Cape Verde'),
    ('KY', 'Cayman Islands'),
    ('CF', 'Central African Rep'),
    ('TD', 'Chad'),
    ('CL', 'Chile'),
    ('CN', 'China'),
    ('CX', 'Christmas Island'),
    ('CC', 'Cocos Islands'),
    ('CO', 'Colombia'),
    ('KM', 'Comoros'),
    ('CG', 'Congo'),
    ('CK', 'Cook Islands'),
    ('CR', 'Costa Rica'),
    ('CI', 'Cote D`ivoire'),
    ('HR', 'Croatia'),
    ('CU', 'Cuba'),
    ('CY', 'Cyprus'),
    ('CZ', 'Czech Republic'),
    ('DK', 'Denmark'),
    ('DJ', 'Djibouti'),
    ('DM', 'Dominica'),
    ('DO', 'Dominican Republic'),
    ('TP', 'East Timor'),
    ('EC', 'Ecuador'),
    ('EG', 'Egypt'),
    ('SV', 'El Salvador'),
    ('GQ', 'Equatorial Guinea'),
    ('ER', 'Eritrea'),
    ('EE', 'Estonia'),
    ('ET', 'Ethiopia'),
    ('FK', 'Falkland Islands (Malvinas)'),
    ('FO', 'Faroe Islands'),
    ('FJ', 'Fiji'),
    ('FI', 'Finland'),
    ('FR', 'France'),
    ('GF', 'French Guiana'),
    ('PF', 'French Polynesia'),
    ('TF', 'French S. Territories'),
    ('GA', 'Gabon'),
    ('GM', 'Gambia'),
    ('GE', 'Georgia'),
    ('DE', 'Germany'),
    ('GH', 'Ghana'),
    ('GI', 'Gibraltar'),
    ('GR', 'Greece'),
    ('GL', 'Greenland'),
    ('GD', 'Grenada'),
    ('GP', 'Guadeloupe'),
    ('GU', 'Guam'),
    ('GT', 'Guatemala'),
    ('GN', 'Guinea'),
    ('GW', 'Guinea-bissau'),
    ('GY', 'Guyana'),
    ('HT', 'Haiti'),
    ('HN', 'Honduras'),
    ('HK', 'Hong Kong'),
    ('HU', 'Hungary'),
    ('IS', 'Iceland'),
    ('IN', 'India'),
    ('ID', 'Indonesia'),
    ('IR', 'Iran'),
    ('IQ', 'Iraq'),
    ('IE', 'Ireland'),
    ('IL', 'Israel'),
    ('IT', 'Italy'),
    ('JM', 'Jamaica'),
    ('JP', 'Japan'),
    ('JO', 'Jordan'),
    ('KZ', 'Kazakhstan'),
    ('KE', 'Kenya'),
    ('KI', 'Kiribati'),
    ('KP', 'Korea (North)'),
    ('KR', 'Korea (South)'),
    ('KW', 'Kuwait'),
    ('KG', 'Kyrgyzstan'),
    ('LA', 'Laos'),
    ('LV', 'Latvia'),
    ('LB', 'Lebanon'),
    ('LS', 'Lesotho'),
    ('LR', 'Liberia'),
    ('LY', 'Libya'),
    ('LI', 'Liechtenstein'),
    ('LT', 'Lithuania'),
    ('LU', 'Luxembourg'),
    ('MO', 'Macau'),
    ('MK', 'Macedonia'),
    ('MG', 'Madagascar'),
    ('MW', 'Malawi'),
    ('MY', 'Malaysia'),
    ('MV', 'Maldives'),
    ('ML', 'Mali'),
    ('MT', 'Malta'),
    ('MH', 'Marshall Islands'),
    ('MQ', 'Martinique'),
    ('MR', 'Mauritania'),
    ('MU', 'Mauritius'),
    ('YT', 'Mayotte'),
    ('MX', 'Mexico'),
    ('FM', 'Micronesia'),
    ('MD', 'Moldova'),
    ('MC', 'Monaco'),
    ('MN', 'Mongolia'),
    ('MS', 'Montserrat'),
    ('MA', 'Morocco'),
    ('MZ', 'Mozambique'),
    ('MM', 'Myanmar'),
    ('NA', 'Namibia'),
    ('NR', 'Nauru'),
    ('NP', 'Nepal'),
    ('NL', 'Netherlands'),
    ('AN', 'Netherlands Antilles'),
    ('NC', 'New Caledonia'),
    ('NZ', 'New Zealand'),
    ('NI', 'Nicaragua'),
    ('NE', 'Niger'),
    ('NG', 'Nigeria'),
    ('NU', 'Niue'),
    ('NF', 'Norfolk Island'),
    ('MP', 'Northern Mariana Islands'),
    ('NO', 'Norway'),
    ('OM', 'Oman'),
    ('PK', 'Pakistan'),
    ('PW', 'Palau'),
    ('PA', 'Panama'),
    ('PG', 'Papua New Guinea'),
    ('PY', 'Paraguay'),
    ('PE', 'Peru'),
    ('PH', 'Philippines'),
    ('PN', 'Pitcairn'),
    ('PL', 'Poland'),
    ('PT', 'Portugal'),
    ('PR', 'Puerto Rico'),
    ('QA', 'Qatar'),
    ('RE', 'Reunion'),
    ('RO', 'Romania'),
    ('RU', 'Russian Federation'),
    ('RW', 'Rwanda'),
    ('KN', 'Saint Kitts And Nevis'),
    ('LC', 'Saint Lucia'),
    ('VC', 'St Vincent/Grenadines'),
    ('WS', 'Samoa'),
    ('SM', 'San Marino'),
    ('ST', 'Sao Tome'),
    ('SA', 'Saudi Arabia'),
    ('SN', 'Senegal'),
    ('SC', 'Seychelles'),
    ('SL', 'Sierra Leone'),
    ('SG', 'Singapore'),
    ('SK', 'Slovakia'),
    ('SI', 'Slovenia'),
    ('SB', 'Solomon Islands'),
    ('SO', 'Somalia'),
    ('ZA', 'South Africa'),
    ('ES', 'Spain'),
    ('LK', 'Sri Lanka'),
    ('SH', 'St. Helena'),
    ('PM', 'St.Pierre'),
    ('SD', 'Sudan'),
    ('SR', 'Suriname'),
    ('SZ', 'Swaziland'),
    ('SE', 'Sweden'),
    ('CH', 'Switzerland'),
    ('SY', 'Syrian Arab Republic'),
    ('TW', 'Taiwan'),
    ('TJ', 'Tajikistan'),
    ('TZ', 'Tanzania'),
    ('TH', 'Thailand'),
    ('TG', 'Togo'),
    ('TK', 'Tokelau'),
    ('TO', 'Tonga'),
    ('TT', 'Trinidad And Tobago'),
    ('TN', 'Tunisia'),
    ('TR', 'Turkey'),
    ('TM', 'Turkmenistan'),
    ('TV', 'Tuvalu'),
    ('UG', 'Uganda'),
    ('UA', 'Ukraine'),
    ('AE', 'United Arab Emirates'),
    ('UK', 'United Kingdom'),
    ('UY', 'Uruguay'),
    ('UZ', 'Uzbekistan'),
    ('VU', 'Vanuatu'),
    ('VA', 'Vatican City State'),
    ('VE', 'Venezuela'),
    ('VN', 'Viet Nam'),
    ('VG', 'Virgin Islands (British)'),
    ('VI', 'Virgin Islands (U.S.)'),
    ('EH', 'Western Sahara'),
    ('YE', 'Yemen'),
    ('YU', 'Yugoslavia'),
    ('ZR', 'Zaire'),
    ('ZM', 'Zambia'),
    ('ZW', 'Zimbabwe')
]

Update 2021: The module has been updated including shortcomings mentioned by @JurajBezručka

🌐
GitHub
github.com › pycountry › pycountry
GitHub - pycountry/pycountry: A Python library to access ISO country, subdivision, language, currency and script definitions and their translations. · GitHub
A Python library to access ISO country, subdivision, language, currency and script definitions and their translations. - pycountry/pycountry
Starred by 964 users
Forked by 140 users
Languages   Python 90.8% | Makefile 8.9% | Nix 0.3%
🌐
Google Groups
groups.google.com › d › msgid › django-users › CAH-SnCD+Y24XvE796wyqNXYaXhT8djSE=hHXmYaXJmSpZ+wDkQ@mail.gmail.com
PyCountry currency formatting woes
In short: the currency numeric is not guaranteed to be the same as the country numeric (in the case of the Euro, how could it possibly be?) The numeric for DE is 276; the numeric for the Euro is 978. Obviously they don't match. PyCountry is a wrapper around some tables provided by Debian; those ...
🌐
PyPI
pypi.org › project › pycountry-convert
pycountry-convert · PyPI
Extension of Python package pycountry providing conversion functions.
      » pip install pycountry-convert
    
Published   Feb 18, 2018
Version   0.7.2
🌐
Pycountry
pycountry.com
PyCountry – My WordPress Blog
Pycountry is a Python library that provides access to standardized ISO reference data for countries, subdivisions, languages, currencies, and scripts.
🌐
GitHub
github.com › jefftune › pycountry-convert
GitHub - jefftune/pycountry-convert: Python conversion functions between ISO country codes, countries, and continents. · GitHub
Python conversion functions between ISO country codes, countries, and continents. - jefftune/pycountry-convert
Starred by 22 users
Forked by 28 users
Languages   Python 82.0% | Makefile 18.0%