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.
Read about regex they should help you :) a useful regex for validating emails is :
An explanation of this can be found here
Here are some good tutorials to start with for regex :
http://fr.slideshare.net/absherzad/java-regular-expression-part-i
http://fr.slideshare.net/absherzad/java-regular-expression-part-ii
And here is a question on SE concerning validating emails in python using regex