How to get domain name of email ID?

0 votes

I am writing a script that will check the domain name and print the name of the domain. For example if the email id is abc@gmail.com, then the output should be Gmail and so on. How can I implement this?

Mar 28 in Python by shri
38 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You can use the split method to split the string into two parts (before and after '@') and then compare it.

Hey, refer to the below code to do this:

email=’abc@gmail.com’

eid=email.split(‘@’)

if eid[1]==’gmail.com’:

    print “Gmail”
answered Mar 28 by Firoz

Related Questions In Python

+1 vote
1 answer

How to replace id with attribute corresponding to id of another table?

Use the following query statement and let ...READ MORE

answered Aug 8, 2018 in Python by Priyaj
• 56,120 points
14 views
0 votes
1 answer

How to get the size of a string in Python?

If you are talking about the length ...READ MORE

answered Jun 4, 2018 in Python by ariaholic
• 7,320 points
48 views
0 votes
1 answer

how to get mongoengine object id in flask program

Check out the documentation, Document.objects is a QuerySet object. You seem to be ...READ MORE

answered Oct 5, 2018 in Python by Priyaj
• 56,120 points
355 views
0 votes
1 answer

how to get mongoengine object id in flask program

Check out the documentation, Document.objects is a QuerySet object. You seem to be ...READ MORE

answered Oct 10, 2018 in Python by Priyaj
• 56,120 points
36 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
20 views
+4 votes
6 answers
0 votes
1 answer

How to get a Mongoengine's object id in a flask program

Check out the documentation, Document.objects is a QuerySet object. You seem to be ...READ MORE

answered Sep 21, 2018 in Python by charlie_brown
• 7,710 points
31 views
0 votes
1 answer

How to replace id with attribute corresponding to id of another table?

Try looking the given link for better ...READ MORE

answered Oct 3, 2018 in Python by Priyaj
• 56,120 points
14 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.