Skip to main content
 首页 » 编程设计

python之使用正则表达式python检测句子中的表情符号

2025年05月04日25insus

<分区>

这是表情列表:http://en.wikipedia.org/wiki/List_of_emoticons 我想形成一个正则表达式来检查句子中是否存在这些表情符号。例如,“嘿,我很好:)”或“我很生气和悲伤:(”但是维基百科上的列表中有很多表情符号,所以想知道我如何才能完成这项任务。 我是正则表达式的新手。 & Python。

>>> s = "hey there I am good :)" 
>>> import re 
>>> q = re.findall(":",s) 
>>> q 
[':']