On Mon, Nov 29, 2021 at 12:10 AM Abdur-Rahmaan Janhangeer <arj.pyt...@gmail.com> wrote: > I found the whole CLDR short name here: > https://unicode.org/emoji/charts/full-emoji-list.html > > However when i do > > >>> print('\N{flag: Mauritius}') > File "<stdin>", line 1 > print('\N{flag: Mauritius}') > ^ > i get > > SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in > position 0-18: unknown Unicode character name > > So is it that Python3.9 does not support it or what is the issue here?
Flags are actually constructed from multiple codepoints. What you want is to insert each codepoint separately. You can see them listed in the second column of the table you linked to. >>> "\U0001F1F2\U0001F1FA" '🇲🇺' To do this with names, you need the names of those two codepoints: '\U0001f1f2' REGIONAL INDICATOR SYMBOL LETTER M '\U0001f1fa' REGIONAL INDICATOR SYMBOL LETTER U >>> "\N{REGIONAL INDICATOR SYMBOL LETTER M}\N{REGIONAL INDICATOR SYMBOL LETTER >>> U}" '🇲🇺' ChrisA -- https://mail.python.org/mailman/listinfo/python-list