100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > python使用正则表达式验证邮箱地址语法有效性

python使用正则表达式验证邮箱地址语法有效性

时间:2020-06-30 04:09:50

相关推荐

python使用正则表达式验证邮箱地址语法有效性

python使用正则表达式验证邮箱地址语法有效性

#python使用正则表达式验证邮箱地址语法有效性

import re # mail regular expression formula# regex = ^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$ regex = ^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$def check(email): """"""if(re.search(regex,email)): print("Valid Email") else: print("Invalid Email") if __name__ == \__main__ : """@to check if the email is validated"""email = "ourearthprotection@" check(email) email = "ourearthprotection999@"check(email) email = "our.earth.protectio

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。