flag
Flag emoji for Python.
Converts flag emoji to ASCII and other way round.
This is based on http://schinckel.net/2015/10/29/unicode-flags-in-python/ by schinckel
How it works
All the flag emoji are actually composed of two unicode letters. These are the 26 regional indicator symbols.
Alone they look like this:
🇦 🇧 🇨 🇩 🇪 🇫 🇬 🇭 🇮 🇯 🇰 🇱 🇲 🇳 🇴 🇵 🇶 🇷 🇸 🇹 🇺 🇻 🇼 🇽 🇾 🇿
If you pair them up according to ISO 3166 some browsers and phones will display a flag.
For example CZ is Czechia: 🇨 + 🇿 = 🇨🇿
So, to encode an ASCII code like :NR: to 🇳🇷, we just need to convert the ASCII N and R to the corresponding regional indicator symbols 🇳 and 🇷.
To reverse it, we translate the regional indicator symbols back to ASCII letters.
Example
>>> import flag
>>> flag.flagize("Flag of Israel :IL:")
'Flag of Israel 🇮🇱'
>>> flag.dflagize(u"Flag of Israel 🇮🇱")
'Flag of Israel :IL:'
Install
pip install emoji-country-flag
Release files for emoji-country-flag 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| emoji-country-flag-1.0.1.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| emoji_country_flag-1.0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 9.4 kB
Release files / emoji-country-flag-1.0.1.tar.gz
| Download URL | emoji-country-flag-1.0.1.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
534c1582d07cf980b9e6da39251b1c638c5ec949eeba58a19d00a93985261378
|
|
BLAKE2b-256 checksum How to use checksums |
19fff6c8e2a2aa96b1ec8045b54a10af6967cc69cd46a57bc5585d20130d5cab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
|
Release files / emoji_country_flag-1.0.1-py2.py3-none-any.whl
| Download URL | emoji_country_flag-1.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7636c115247525fe753df25b8b19e1a8cc3e93d563187142e0e982bc40eec417
|
|
BLAKE2b-256 checksum How to use checksums |
1f3cbbb727bb5ddbc9f77805e8d22d0f24f0f70eb792d6dc807c07e3721423a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
|