如何使用正则表达式在Python中验证电子邮件地址?
下面的代码使用Python中的正则表达式验证任何给定的电子邮件地址
更多Python相关文章,请阅读:Python 教程
例子
import re
s = 'manogna.neelam@tutorialspoint.com'
match = re.search(r'\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b', s, re.I)
print match.group()
输出
这将给出输出
manogna.neelam@tutorialspoint.com
极客教程