Type Here to Get Search Results !

Email Slicer with Python

 An Email slicer is a very useful program for separating the username and domain name of an email address. In this article, I will explain how to write a program to create an Email Slicer with Python.

Email Slicer with Python

To create an email slicer with Python, our task is to write a program that can retrieve the username and the domain name of the email. For example, look at the image below which shows the domain and username of “support@thecleverprogrammer.com”:

email slicer with Python


So we need to divide the email into two strings using ‘@’ as the separator. Let’s see how to separate the email and domain name with Python:

Source Code:



Enter Your Email: support@thecleverprogrammer.com
Your user name is ‘support’ and your domain is ‘thecleverprogrammer.com’

The code above is very simple and easy to understand. We take user input and use the strip function at the same time to remove white space if any. Then we are finding the index of ‘@’ symbol of the user input. Then we store the index into a variable known as domain_name to split the email into two parts; the user name and the domain.

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.