You are viewing a single comment's thread. Return to all comments →
import email.utils import re noOfInp = int(input()) pattern = r'^[a-zA-Z]+[\w-.]+@[a-zA-Z]+.{1}[a-zA-Z]{1,3}$'
def isValidEmail(username, mail): m = re.match(pattern, mail) if m: tupl = (username, mail) print(email.utils.formataddr(tupl))
for i in range(noOfInp): inp = input() username = email.utils.parseaddr(inp)[0] mail = email.utils.parseaddr(inp)[1] isValidEmail(username, mail)
Seems like cookies are disabled on this browser, please enable them to open this website
Validating and Parsing Email Addresses
You are viewing a single comment's thread. Return to all comments →
import email.utils import re noOfInp = int(input()) pattern = r'^[a-zA-Z]+[\w-.]+@[a-zA-Z]+.{1}[a-zA-Z]{1,3}$'
def isValidEmail(username, mail): m = re.match(pattern, mail) if m: tupl = (username, mail) print(email.utils.formataddr(tupl))
for i in range(noOfInp): inp = input() username = email.utils.parseaddr(inp)[0] mail = email.utils.parseaddr(inp)[1] isValidEmail(username, mail)