import re
def filter_emoji(text):
emoji_pattern = re.compile("["
u"\U0001F600-\U0001F64F" # emoticons
u"\U0001F300-\U0001F5FF" # symbols & pictographs
u"\U0001F680-\U0001F6FF" # transport & map symbols
u"\U0001F1E0-\U0001F1FF" # flags (iOS)
"]+", flags=re.UNICODE)
return emoji_pattern.sub(r'', text)
# 示例:
text = "Hello, this is a 【假装我是个表情】 smiley face"
filtered_text = filter_emoji(text)
print(filtered_text) # "Hello, this is a smiley face"
python爬虫文本过滤去除表情符号代码
最新推荐文章于 2024-08-20 13:04:52 发布