版本1:
def is_valid_email(addr):
if re.match(r'^([0-9a-zA-Z\_\.]+)\@([0-9a-zA-Z]+)\.(\w{2,3})$', addr): return True else: return False
版本2:
def name_of_email(addr):
if addr[0] == "<": m = re.match(r'^\<([0-9a-zA-Z\_\s]+)*', addr) return m.group(1) else: m = re.match(r'^([0-9a-zA-Z\_\.]+)*', addr) return m.group(1) return None
return list(filter(None, re.split(r'[\<\>\@]+', addr)))[0]
Sign in to make a reply
筱枫_Edward
版本1:
def is_valid_email(addr):
版本2:
def name_of_email(addr):