Discuss / Python / 交作业试试

交作业试试

Topic source

永恆生命

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

#验证邮箱(版本一)

import re

email = input('please input email:') if re.match(r'^([a-zA-Z_]+)(._a-zA-Z)|([a-zA-Z_]+)@([0-9a-zA-Z.]+)$',email): print(email) else: print('wrong email')

#验证并提取出带名字的Email地址(版本二)

import re

email = input('please input email:') reemail = re.compile(r'^([a-zA-Z0-9\s\<>]+)\s([a-zA-Z.0-9_]+)@([0-9a-zA-Z.]+)$') if reemail.match(email): print(reemail.match(email).group(1)) else: print('wrong email')

安迪博德

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

"@"后面的部分不严谨,难道可以输入"somone@..."?


  • 1

Reply