Python: Unicode Escape Sequence
Unicode Escape sequence lets you embed unicode character into string, by their Code Point or character name. There are the following forms:
\u4_digits_hex-
A character whose
Unicode Code Point is 4 hexadecimal digits or less. If less, must pad 0 in front.
# BLACK HEART SUIT, hexadecimal 2665 print("♥" == "\u2665") # True \U8_digits_hex-
A character whose Unicode Code Point is more than 4
Hexadecimal
digits. If less than 8 digits, you must pad 0 in front to make a total of 8 digits.
# GRINNING CAT FACE WITH SMILING EYES, hexadecimal 1f638 print("😸" == "\U0001f638") # True \N{name}-
Unicode character named name
(To find a Unicode Code Point and name, see Unicode Search 🔍)
# BLACK HEART SUIT, hexadecimal 2665 print("♥" == "\N{BLACK HEART SUIT}") # True