Discuss / Python / 交作业

交作业

Topic source

Alvin天枭

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

############################################################### # 练习 1

############################################################### # -- coding: utf-8 -- import re

def is_valid_email(addr): return re.match(r'^([a-zA-Z0-9.]+)@(\w+.com)$', addr)

############################################################### # 练习 2

############################################################### # -*- coding: utf-8 -*- import re

def name_of_email(addr): m=re.match(r'^\<(\w{3})\s(\w{5})>\s+(\w+)\@(\w+).(\w+)$',addr) if m: return m.group(1)+' '+m.group(2) else: m=re.match(r'^(\w{3,8})\@(\w+).(\w+)$',addr) return m.group(1)

DeepEndBoo

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

is_valid_email('.....@color.com')


  • 1

Reply