This may seem a stupid question, but how can I write a simple email validation program in Python? I'm quite new to the software and I've missed a couple of IT lessons, so I really have no idea what to do.
This is as far as I've gotten (yes, I know it doesn't do anything useful):
email = input ("Please type in an email address ")
splitemail = email.split('@')
emailstr = ''.join(splitemail)
splitemail2 = emailstr.split('.')
print (splitemail2)
The email needs to have this pattern: [alphanumeric character(s)] @ [alphanumeric character(s)] . [alphanumeric character(s)]
Then the program must determine whether is is valid or not and output 'VALID' or 'INVALID'.
Thanks for reading, and any help would be greatly appreciated.
You can use the
string.isalum()
function to solve this.example:
Here is an example in-out: