def _validate_simple ( email ) : name , address = parseaddr ( email ) if not re . match ( '[^@]+@[^@]+\.[^@]+' , address ) : raise ValueError ( 'Invalid email :{email}' . format ( email = email ) ) return address
verify email format regex python
Does a simple validation of an email by matching it to a regexps
def _validate_simple(email):
        """Does a simple validation of an email by matching it to a regexps

        :param email: The email to check
        :return: The valid Email address

        :raises: ValueError if value is not a valid email
        """
        name, address = parseaddr(email)
        if not re.match('[^@]+@[^@]+\.[^@]+', address):
            raise ValueError('Invalid email :{email}'.format(email=email))
        return address