You are viewing a single comment's thread. Return to all comments →
import re emailregex = re.compile(r'([a-zA-Z0-9_-]{1,})(@)([a-zA-Z0-9]+)(\.)([a-z|A-Z]{1,3})',re.VERBOSE) def fun(emails): return bool(emailregex.fullmatch(str(emails))) def filter_mail(emails): return list(filter(fun, emails)) if __name__ == '__main__': n = int(input()) emails = [] for _ in range(n): emails.append(input()) filtered_emails = filter_mail(emails) filtered_emails.sort() print(filtered_emails)
Seems like cookies are disabled on this browser, please enable them to open this website
Validating Email Addresses With a Filter
You are viewing a single comment's thread. Return to all comments →