[Tutor] email validation

Alan Gauld alan.gauld at btinternet.com
Sun Aug 2 16:12:01 CEST 2015


On 02/08/15 09:31, Alan Gauld wrote:

> them outside the main block and use them in your tests. In that case you
> only need one function which I'd call something like test_email()

Ahem. Or you could call it is_good_address() of course! Oops!

> def is_good_address(addr):
>       if '@' not in addr or '.' not in addr:
>           print('email needs @ and . at the same time')
>           return False
>       else: return True

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list