# coding=utf-8 import re # 匹配两个字符中间的所有字符 a ='life is short, i use pythoni love it' r = re.findall(r'life(.*?)it',a) print(r)