Discuss / Python / 作业2

作业2

Topic source

状态空间

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

def name_of_email(addr):

    re_email_1 = re.compile(r'<([a-zA-Z\s]+)>\s\w+\@\w+\.\w+')

    re_email_2 = re.compile(r'(\w+)\@\w+\.\w+')

    if '<' in addr:

        return re_email_1.match(addr).group(1)

    else:

        return re_email_2.match(addr).group(1)


  • 1

Reply