import re strr = "china today is chinaa" pattern = re.compile(r'\bchina\b') print(pattern.findall(strr))
运行结果如下所示: