这个问题在这里被问到Python : How to remove all emojis without a solution,我已经朝着解决方案迈出了一步。但需要帮助完成它。
我从表情符号网站上获取了所有表情符号十六进制代码点:https : //www.unicode.org/emoji/charts/emoji-ordering.txt
然后我像这样读入文件:
file = open('emoji-ordering.txt')
temp = file.readline()
final_list = []
while temp != '':
#print(temp)
if not temp[0] == '#' :
utf_8_values = ((temp.split(';')[0]).rstrip()).split(' ')
values = ["u\\"+(word[0]+((8 - len(word[2:]))*'0' + word[2:]).rstrip()) for word in utf_8_values]
#print(values[0])
final_list = final_list + values
temp = file.readline()
print(final_list)
Run Code Online (Sandbox Code Playgroud)
我希望这会给我 unicode 文字。不是,我的目标是获得 unicode 文字,这样我就可以使用上一个问题的部分解决方案,并能够排除所有表情符号。任何想法我们需要什么才能获得解决方案?