Skip to main content

A library to map country names to ISO codes.

Project description

# countrynames

This library helps with the mapping of country names to their respective
ISO 3166-1 alpha-2, alpha-3, and numeric codes or official names. The idea is
to incorporate common names for countries, and even some limited misspellings,
as they occur in source data.

## Usage

```python
import countrynames

assert 'DE' == countrynames.to_code('Germany')
assert 'DE' == countrynames.to_code('Bundesrepublik Deutschland')
assert 'DE' == countrynames.to_code('DE')
assert 'Germany' == countrynames.to_name('Deutschland')
assert 'Federal Republic of Germany' == countrynames.to_official_name('Deutschland')
assert 'DEU' == countrynames.to_alpha_3('Germany')
assert '004' == countrynames.to_numeric('Afghanistan')
```

## Non-standard countries

* ``XK`` - Kosovo
* ``EU`` - European Union

## License

The MIT License (MIT)

Copyright (c) 2016 Friedrich Lindenberg

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

countrynames-1.4.tar.gz (223.2 kB view details)

Uploaded Source

Built Distribution

countrynames-1.4-py2-none-any.whl (225.9 kB view details)

Uploaded Python 2

File details

Details for the file countrynames-1.4.tar.gz.

File metadata

  • Download URL: countrynames-1.4.tar.gz
  • Upload date:
  • Size: 223.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for countrynames-1.4.tar.gz
Algorithm Hash digest
SHA256 0008c2a442f707f5d0bba5ea9d541bd574b578d4fef2330f50cc089ea656be62
MD5 10ef3a3116bb326e0bdb9da02352dc43
BLAKE2b-256 2b919d703ff9d417038d083807e75fcbaf0f5a6139726e06498dafdc31c07461

See more details on using hashes here.

File details

Details for the file countrynames-1.4-py2-none-any.whl.

File metadata

File hashes

Hashes for countrynames-1.4-py2-none-any.whl
Algorithm Hash digest
SHA256 a858d7ad20c0e1911b33015d79d2f0a25f02b3477a9920368468ae14997ffbb2
MD5 01f6352a6b9dc8aed9a6cfc5438a7959
BLAKE2b-256 193f4ac86fc5316d86103d7c33b6b0094f72d487adb845827cbb48f38a38f21b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page