Skip to content

Instantly share code, notes, and snippets.

@sayantanHack
Created May 3, 2019 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sayantanHack/4a897865cf85886c8efbeb1a06013e37 to your computer and use it in GitHub Desktop.
Save sayantanHack/4a897865cf85886c8efbeb1a06013e37 to your computer and use it in GitHub Desktop.
import email.utils as eu
num = int(raw_input(""))
lst=[]
for i in range(num):
f = raw_input("")
li = eu.parseaddr(f)
unm = li[1].split("@")[0]
dom = li[1].split("@")[1].split(".")[0]
ext = li[1].split("@")[1].split(".")[1]
if(unm.isalum()==True):
if((dom>='a' and dom<='z') or (dom>='A' and dom<='Z')):
if((len(ext)==1 or len(ext)==2 or len(ext)==3) and ((dom>='a' and dom<='z') or (dom>='A' and dom<='Z'))):
lst.append(f)
elif(('.' in unm== True) or ('-' in unm== True) or ('_' in unm== True)):
if((dom>='a' and dom<='z') or (dom>='A' and dom<='Z')):
if((len(ext)==1 or len(ext)==2 or len(ext)==3) and ((dom>='a' and dom<='z') or (dom>='A' and dom<='Z'))):
lst.append(f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment