+ 1
i want the email --input()-- to be an actual email instead of string because the user will enter anything and this is a Mess🥹?
3 ответов
+ 9
BLK ,
there is a special python modul available for the purpose of email validating that can be installed. you should read the key features.
https://pypi.org/project/email-validator/
+ 4
For exaple to check if an email is valid you can check if the string contains ‘@‘
You can check it like this
(“bad_email”).__contains__(“@“) -> False
(“good_email@gmail.com).__contains__(“@“) -> True
Other method:
email = input() -> “bad_email”
email2 = input() -> “good_email@gmail.com”
print(“@“ in email) -> False
print(“@“ in email2) -> True
Hope this helps you