Reputation: 91
from email_validator import validate_email, EmailNotValidError
email = "[email protected]"
try:
# Validate.
valid = validate_email(email)
# Update with the normalized form.
email = valid.email
except EmailNotValidError as e:
# email is not valid, exception message is human-readable
print(str(e))
I am using this but I am getting ModuleNotFoundError: No module named 'dns'
.
Upvotes: 2
Views: 2315
Reputation: 56
What probably happend is that you uninstalled the dnspython package after instaling the email-validator package.
The email-validator package needs the dnspython
Open a command line and input pip install dnspython
, then restart your editor and that should do it.
Upvotes: 2