Email Slicer App using Python with Source codes

Email Slicer App using Python with Source codes

Email Slicer Using Python.

What is an Email Slicer?

Email Slicer is nothing but just a tool or app which will take an email id as an input and will perform slicing operations on it to return the username and the domain of the email id address. Therefore Our focus is here is to print out the username and the domain name from any given Email.

How to Separate username and domain from Email

Firstly, to know the domain name of any Email address is very simple just check what comes after the symbol @ and what comes before it is always the username. For example

slice.jpg so, with the example above we discover that the character from the begining till the '@' symbol exclusive is our username. while all characters that follow the symbol till the end are the domain.i.e the symbol serves as separator. so, how do we do this with codes?? this is the codes below Codes>>>

# Email Slicer with python
userEmail=str(input('Enter your Email address: '))
seperator='@'
seperatorIndex=userEmail.index(seperator)
username=userEmail[:seperatorIndex]#from the begining to the seperator index
domainName=userEmail[seperatorIndex+1:] #after seperator index till the end.
print(f"the username is '{username}' and domain name is '{domainName}'")

Result>>

Enter your Email address: myEmail@gmail.com
the username is 'myEmail' and domain name is 'gmail.com'

Now user can input the mail and we will get our username and domain. I hope you find this article helpful?? comment below if you have any question or correction. you can also chat me up on 09153036869 it's your guy Maxwizard! enjoy coding...