Question: Hello, In Python, I am trying to create a function that will return the domain name from any inputted email address. For example, my input
Hello,
In Python, I am trying to create a function that will return the domain name from any inputted email address. For example, my input of john@domainname.com would return just the domainname. It needs to be done using regular expressions and the map function. I'm still stuck on trying to get the correct parameters for regular expression and also what is throwing it off. Thank you for your help!
I am currently working with a list of different email addresses named email_list and my code thus far looks like:
def domain(email): a = re.findall('\S+@\S+', email_list) return(a)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
