Advertisement
TShiva

email_parse

Jul 18th, 2016
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. import re
  2.  
  3. f = open('Emails.txt')
  4. valid = []
  5. invalid = []
  6. i = 0
  7. regexp = r'^((\w+)|(\.|-)?)+@((\w+|-|_)+\.[a-zA-Z0-9-.]+$'
  8. for email in f.readlines():
  9.     print(i)
  10.     print(email)
  11.     i += 1
  12.     email = email.strip()
  13.     if re.match(r"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$", email):
  14.         valid.append(email)
  15.     else:
  16.         invalid.append(email)
  17. print(invalid)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement