的
re.findall唯一回报捕获与捕获的值
捕获组 正则表达式模式的内部。
使用
re.finditer它将保留第零组(整个匹配项):
import rep = re.compile(r'[abcgr]([a-z])1[ldc]')s = "reel reed have that with this they"print([x.group(0) for x in p.finditer(s)])
见IDEONE演示

的
re.findall唯一回报捕获与捕获的值
使用
re.finditer它将保留第零组(整个匹配项):
import rep = re.compile(r'[abcgr]([a-z])1[ldc]')s = "reel reed have that with this they"print([x.group(0) for x in p.finditer(s)])
见IDEONE演示