Created
May 1, 2023 14:56
-
-
Save thesuhu/ea5b9de9350fbce65f9e744817752005 to your computer and use it in GitHub Desktop.
Get Country Flag Emoji
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_country_flag(country_code): | |
OFFSET = 127397 | |
codepoints = tuple(ord(char) + OFFSET for char in country_code.upper()) | |
return chr(codepoints[0]) + chr(codepoints[1]) | |
# usage get_country_flag("ID") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment