代码示例:(标识:python_regex_findall_2)
python_regex_findall_2.py
import re

str = "China is a great country"

#Check if "USA" is in the string:

x = re.findall("USA", str)
print(x)

if (x):
  print("Yes, there is at least one match!")
else:
  print("No match")
运行结果: