Reputation: 9375
Say I have the following HTML emoji entity: '😄 ;'
Note there isn't actually a space between the 4 and the ; it's just there so that it doesn't show up as a smiley
The emoji's Python form is: u"\U0001f604"
How do I convert all HTML emoji entities to their Python form?
Things I have tried so far:
Upvotes: 2
Views: 1523
Reputation: 168706
HTMLParser.unescape
does just that:
In [3]: HTMLParser.HTMLParser().unescape( '😄' )
Out[3]: u'\U0001f604'
Upvotes: 5