Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Political enums: continent, country (ISO 3166-1), subdivision (ISO 3166-2), currency (ISO 4217) and keyboard layouts (debian).

Project description

Several dead-simple political python Enums: pip install poli-enum.

Python 3.6+ supported.



Continent codes from Data hub.

from poli_enum.continent import Continent
Continent.EU.value == 'Europe'


Country codes as ISO 3166-1 alpha 2, taken from iso-3616-1 commit 8e31d749b9ce331cfa50c280a29b04ae2d805b7e.

from import Country
Country.ES.value == 'Spain'


Subdivision country codes from ISO 3166-2. Taken from GEFEG.

from poli_enum.subdivision import Subdivision
catalonia = Subdivision['ES-CA']

You can check whether a subdivision is part of a country:

from import Country
from poli_enum.subdivision import Subdivision
Subdivision['US-FL'] in Country.US == True


Currency codes as for ISO 4217 and currency symbols as for

from poli_enum.currency import Currency
Currency.EUR.value == 34

For Currency.EUR and Currency.USD, you can get their currency sign:

from poli_enum.currency import Currency
Currency.EUR.symbol == '€'
Currency.PHP.symbol == '₱'
f'Cost: 54{Currency.EUR:s}' == 'Cost: 54€'


from poli_enum.currency import Symbol
Symbol.GBP.value == '£'


Keyboard layout codes. From Debian 9 /usr/share/X11/xkb/rules/evdev.lst.

from poli_enum.layout import Layout
Layout.US.value == 'English (US)'
Layout.BRAI.value == 'Braille'


  1. git clone this project.
  2. Execute python test in the project folder.


Is a missing or wrong code? Say it in the issues! Feel free to contribute.

Project details

Release history Release notifications

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for poli-enum, version 1.0
Filename, size File type Python version Upload date Hashes
Filename, size poli-enum-1.0.tar.gz (20.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page