正则匹配身份证和邮箱
import re str='sfafsf,34234234234,1231313132,37132719991123463x,sdefgr54184785ds85,' \ '4864465asf86845,372526198911233456' con = re.findall(r'[\d]{17}[0-9xX]' , str) for i in con: print('身份证:', i) y='123@qq.comaaa@163.combbb@126.comasdfasfs33333@adfcom' ret=re.findall('\w+@[0-9a-zA-Z]+\.com',y) print(ret)