import re text="_name:Chen Jun,password:ILOVEYOU paas" result=re.findall(r"(.n)|(YOU)",text)#表示分组,根据元组特性,单个元素的元组要加, print(result)