Discuss / Python / 第二个练习感觉不太像正式的邮箱地址,还能带空格的么

第二个练习感觉不太像正式的邮箱地址,还能带空格的么

Topic source

天命破凰

#1 Created at ... [Delete] [Delete and Lock User]

import re

def is_valid_email(addr): if re.match(r'^[a-zA-Z]\w+[.]?\w+@\w+[.][a-zA-Z]{2,4}$',addr): return True else: return False

def name_of_email(addr): mukuai = re.compile(r'<?([a-zA-Z]+[.]?\s?[a-zA-Z]+)>?\s?\d\w@\w+[.][a-zA-Z]{2,4}$') return mukuai.match(addr).group(1)


  • 1

Reply