Registry / serialization / emoji-country-flag

emoji-country-flag

JSON →
library2.1.0pypypi✓ verified 81d ago

Encode/decode unicode country flag emoji. Version 2.1.0; supports Python >=3.10. Regularly updated to match ISO 3166-1 changes.

pip install emoji-country-flag
INSTALL
IMPORT
SIG · EMOJI-COUNTRY-FLAG
E
emoji-country-flag
serializationpythonv2.1.0
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Flag
from flag import Flag
from emoji_country_flag import Flag

Create a Flag object or use functions to encode country code to emoji and decode emoji to country code.

from emoji_country_flag import Flag flag = Flag(code='US') print(flag.emoji) # 🇺🇸 # or using get_flag from emoji_country_flag import get_flag, decode_flag emoji = get_flag('US') print(emoji) # 🇺🇸 code = decode_flag(emoji) print(code) # US
Debug
Known issues
breakingVersion 2.0.0+ requires Python 3.10 or later. Python 3.6-3.9 no longer supported.
fix
Upgrade to Python 3.10+ or pin to version 1.x (e.g., pip install 'emoji-country-flag<2')
affects: >=2.0.0
deprecatedThe function `get_flag()` is deprecated in favor of `Flag()` class in version 1.2.0+.
fix
Use `Flag(code).emoji` instead of `get_flag(code)`.
affects: >=1.2.0
gotchaCountry codes must be ISO 3166-1 alpha-2 uppercase. Lowercase or full country names are not recognized.
fix
Always use uppercase two-letter codes (e.g., 'US', 'GB').
affects: all
Upgrade
Version history
2.1.0latest on PyPI · released Sep 21, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
25 hits · last 30 days
node
20
Amazon
1
OpenAI (training)
1
Resources
emoji-country-flag — pip install emoji-country-flag · libregistry