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 “”:

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:

Enter Your Email:
Your user name is ‘support’ and your domain is ‘’

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.

Also, Read – 100+ Machine Learning Projects Solved and Explained.

Finally, we are just formatting to print the output. The above code can be enhanced with more ideas depending on your needs. As a beginner, you must try these types of programs to improve your coding skills. In the long run, it will also help you build your algorithms and increase your ability to think logically.

I hope you liked this article on how to create an email slicer with Python programming language. Feel free to ask your valuable questions in the comments section below.

Aman Kharwal
Aman Kharwal

I'm a writer and data scientist on a mission to educate others about the incredible power of data📈.

Articles: 1501


  1. user_input = str(input(“enter e-mail address : “))
    result = user_input.split(‘@’)
    print(“username : “,result[0])
    print(“domain name : “,result[1])

    Is this a good algorithm sir.,

  2. username, domain = input(“Enter your e-mail: “).split(“@”)
    print(f”Your Username is {username} and Domain Address is {domain}”)
    how is this sir.

Leave a Reply