第一题:
re.match(r'^(\w+(\.)?\w+)@(\w+)(.com){1}$', addr)
第二题:
def name_of_email(addr): res = re.match(r'^<?(\w+\s?\w+)>?\s?(\w){0,}@(\w+\.\w+)', addr) if res: print(res.groups()) # 根据正则表达式括号部分分组 return res.group(1) else: return False
Sign in to make a reply
吃货
第一题:
第二题: