Discuss / Python / 很久没有交作业了

很久没有交作业了

Topic source

醉后诀

#1 Created at ... [Delete] [Delete and Lock User]
     #第一题

def is_valid_email(addr): if(re.match(r'[a-z]+.?[a-z]*@[a-z]+.com',addr)): return True else: return False

    #第二题
    def name_of_email(addr):
m=re.match(r'<?([a-z\s?A-Z]+)>?\s?\.?[a-z]*@[a-z]+\.(com|org)$',addr)
if(m):
    print (m.group(1))         
    return m.group(1)
else:
    return None

  • 1

Reply