When creating a button for a bot, it was necessary to add a smiley to the telegram, some with the \u2139 code (for example) work fine, but how to insert the smiley with the code u+1f525 if it takes the last 5 as text?

  • u"\U0001F525" - diraria

1 answer 1

 >>> "\u2139" 'ℹ' >>> "\U0001f525" '🔥' 

After \u always 4 hex numbers come. After \U always 8 . See String and Bytes literals .

Of course, it is not necessary to use escape sequences:

 >>> 'ℹ' 'ℹ' >>> '🔥' '🔥' 

This creates the same lines:

 >>> '🔥' == '\U0001f525' True 

This also works for compound characters:

 >>> '🇷🇺' == '\U0001f1f7\U0001f1fa' True