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