Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Thu Nov 21 16:58:20 2019
- @author: VladimirZamyatin
- """
- from validate_email import validate_email
- def domainDict(email_file):
- temp = {}
- with open(email_file, 'r') as f:
- for line in f:
- line = line.strip().split('@')
- temp[line[-1]] = True
- return(temp)
- def readEmails(email_file):
- temp = {}
- with open(email_file, 'r') as f:
- for line in f:
- line = line.strip()
- temp[line] = False
- return(temp)
- #print(len(domainSet('BGRS2020_emails.txt')))
- emails = readEmails('BGRS2020_emails.txt')
- emails = ['asiodhaiodoipnsdio@gmail.com', 'zamyatin97@gmail.com']
- verified_domains = set()
- for email in emails:
- domain = email.split("@")[-1]
- domain_verified = domain in verified_domains
- is_valid = validate_email(email_address = email, check_mx = not domain_verified)
- if is_valid:
- emails[email] = True
- verified_domains.add(domain)
- with open('valid_BGRS2020_emails.txt', 'w') as f:
- f.write(email + '\n')
- print(1)
- else: print(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement