Validating an email format in python
Question: I'm trying to write a program that checks to see if the email is in the valid
form. A valid form would be any combination of characters of letters or
numbers followed by a `@` sign and then any combination of characters of
letters again. I'm not even trying to have a domain such as "gmail.com" it can
just be new@gmail for example. I've tried many things and can't seem to figure
it out.

    
    
    email = "XXX@XXX"
    x = len(email)
        for i in range(x):
            if email[i][0] == "@":
                return False
            elif email[i][-1] == "@":
                return False
            elif not email[i].isalnum():
                return False
        return True
    


Answer: You can use this package:

<https://pypi.python.org/pypi/validate_email>

    
    
    from validate_email import validate_email
    is_valid = validate_email('example@example.com')
    

