Skip to main content
https://github.com/bulv1ne/country_list/actions/workflows/python-app.yml/badge.svg https://img.shields.io/pypi/v/country_list.svg Updates https://coveralls.io/repos/github/bulv1ne/country_list/badge.svg?branch=master https://img.shields.io/badge/code%20style-black-000000.svg Quality Gate Status

Features

  • List of all countries with names and ISO 3166-1 codes in all languages and all data formats.

Installation

Install country_list by running:

pip install country_list

Usage

Get all available languages:

from country_list import available_languages

for language in available_languages():
    print(language)

Get country names in english and swedish:

>>> from country_list import countries_for_language
>>> # countries_for_language returns a list of tuples now, might be changed to an OrderedDict
>>> countries = dict(countries_for_language('en'))
>>> print(countries['GB'])
'United Kingdom'
>>> print(countries['SE'])
'Sweden'
>>> countries = dict(countries_for_language('sv'))
>>> print(countries['GB'])
'Storbritannien'
>>> print(countries['SE'])
'Sverige'

Get country codes from country name:

>>> from country_list import countries_for_language
>>> # countries_for_language returns a list of tuples now, might be changed to an OrderedDict
>>> country_names = {name: code for code, name in countries_for_language('en')}
>>> print(country_names['United Kingdom'])
'GB'
>>> print(country_names['Sweden'])
'SE'
>>> country_names = {name: code for code, name in countries_for_language('sv')}
>>> print(country_names['Storbritannien'])
'GB'
>>> print(country_names['Sverige'])
'SE'

Credits

This package contains the data files from umpirsky/country-list.

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

License

The project is licensed under the MIT license.

Metadata

Release files for country_list 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for country_list 1.1.0
File Size Uploaded
country_list-1.1.0.tar.gz 325.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for country_list 1.1.0
File Interpreter ABI Platform
country_list-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.9 MB

Release files / country_list-1.1.0.tar.gz

Download URL country_list-1.1.0.tar.gz
Size 325.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2357db0e311f3f3f9923956e2fcbca88b1ec10beb2ff33579a0cc4548f95cfb4
BLAKE2b-256 checksum
How to use checksums
8698174a73c0843faa7f9b3fd141f8ff300a333ac28e30b490ee7ebbe45d27e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.0 CPython/3.11.4 Darwin/23.0.0

Release files / country_list-1.1.0-py3-none-any.whl

Download URL country_list-1.1.0-py3-none-any.whl
Size 1.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
6d95034704ad622d0d7391dbe3d63d571ef739817646d43f845c7256fb562fc3
BLAKE2b-256 checksum
How to use checksums
279198cfcce4f3fac57f6b9bfcc4ff927ad52f5794755584fbaacc34beea36d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.0 CPython/3.11.4 Darwin/23.0.0

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page