使用 findall()函数

  1. import re
  2.  
  3. #Return a list containing every occurrence of "ai":
  4.  
  5. str = "China is a great country"
  6. x = re.findall("a", str)
  7. print(x)