+ 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🥹?

https://code.sololearn.com/ciIRwkmr3XjZ/?ref=app

30th Apr 2023, 12:18 PM
BLK
BLK - avatar
3 odpowiedzi
+ 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/
30th Apr 2023, 2:24 PM
Lothar
Lothar - avatar
+ 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
30th Apr 2023, 1:09 PM
Ugulberto Sánchez
Ugulberto Sánchez - avatar