I want to paint an emoji in html in the following way: ?
😁
and for this, I have your code in unicode:
U+1F601
How do I transform this: U+1F601 into this 😁
with python 2.7
I want to paint an emoji in html in the following way: ?
😁
and for this, I have your code in unicode:
U+1F601
How do I transform this: U+1F601 into this 😁
with python 2.7
You don't even need to know its Unicode code, just have a way to insert it into the editor (by copying and pasting it from another site, for example).
Now, if you don't have a way to write it easily but you know its unicode code, you can use the escape character in
\U
front of the code, although in that case you need to specify the code in 32 bits (8 hexadecimal figures), which in your case would be\U0001F601
. So:If what you have is
"U+1F601"
in string form, it may be easier to make a function that does the conversion since really all you have to do is take out the code after theU+
, convert it from hex to an integer, and return that integer. with a&#
before and a semicolon after.The following function would do that:
Usage example: