检索字符串是否以 "China" 开头并以 "country" 结尾检索字符串是否以 "China" 开头并以 "country" 结尾import re txt = "China is a great country"x = re.search("^China.*country$", txt) if (x): print("YES! We have a match!")else: print("No match")