Convert strings to emoji in python

Viewed 3157

I have a collection of twits and i want to check emojis in them, but it looks like the writing procedure for the collection converted all emojis in string for example '' is ':-)' in text and '' is ':D' and so on with all emojis. If we try to check unicode codepoints for them we get ':-)'.encode('utf-8') equals to b':-)' in the same time ''.encode('utf-8') equals to 'b'\xf0\x9f\x98\x8a and equality check fails. Using utf-16 : ':-)'.encode('utf-16') equals to b'\xff\xfe:\x00-\x00)\x00' and ''.encode('utf-16') is b'\xff\xfe=\xd8\n\xde' . So is there any way to convert text representations such as ':-)' back to emoji ''.

1 Answers
Related