Discuss / Python / 作业

作业

Topic source

第一题

def is_valid_email(addr):

    if re.match(r'^\w*\.?\w+?\@\w*\.com$',addr):

         return True

    else:

         return False

第二题

def name_of_email(addr):

    s=re.match(r'\<?([\s\w]+)\>?[\s\w]*@(.*)',addr).group(1)

    return s

有为若是

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

真得很简洁,字符数量定义的示例有针对性,感谢扩充思路。


  • 1

Reply