且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Python中将unicode表情符号转换为ASCII表情符号

更新时间:2022-12-11 13:31:53

我发现这些存储库具有巨大的表情符号数据库以及text属性(您需要什么):

I found these repos that have a huge database of emoji's along with a text attribute(what you need):

https://github.com/alexmick/emoji-data-python

https://github.com/iamcal/emoji-data (这是原始的.似乎是python的包装)

https://github.com/iamcal/emoji-data (This is the original. The python one seems to be a wrapper on this)

您可以通过阅读回购中的示例来了解更多信息.来自 对于python版本,您可以使用正式的Unicode名称/十六进制代码来获取EmojiChar对象:

You can find out more by exploring the examples in the repos. From the For the python version you can use the official unicode name/hex code to get the EmojiChar object:

In [31]: grin = emoji_data_python.find_by_name("GRINNING FACE")

In [32]: grin
Out[32]:
[EmojiChar("GRINNING FACE"),
 EmojiChar("GRINNING FACE WITH SMILING EYES"),
 EmojiChar("GRINNING FACE WITH STAR EYES"),
 EmojiChar("GRINNING FACE WITH ONE LARGE AND ONE SMALL EYE")]

In [33]: grin[0].text
Out[33]: ':D'