无意中看到了Python3居然可以支持emoji表情,之前还不知道,觉得很有意思。
pypi现有的库emoji来处理emoji字符串:https://pypi.org/project/emoji/
安装:
pip install emoji --upgrade
小试牛刀:
import emoji
result = emoji.emojize("Python is :thumbs_up:")
print(result)
result = emoji.demojize("Python is 👍")
print(result)
result = emoji.emojize('Python is :red_heart:')
print(result)
运行结果:
Python is 👍
Python is :thumbs_up:
Python is ❤