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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started