s= 'abababab'不重复统计s.count('aba')重复统计 import rereg=re.compile("(?=aba)")length=len(reg.findall(s))print(length)