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