Email slicer using Python with source code

  • Post author:
  • Post comments:0 Comments
  • Reading time:19 mins read

Demystify email addresses and gain insights into user data with the Python Email Slicer. In this project, you’ll learn how to create a Python script that extracts and analyzes components of an email address.

Whether you’re a data analyst, marketing professional, or just curious about the information hidden in email addresses, this step-by-step guide will help you dissect and organize email data using Python. Join us in exploring the world of email slicing, and unraveling the mysteries of electronic communication through the power of Python!


import re

def isValidEmail(email):

    # Regular expression for validating an Email
    regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
 
    if(re.fullmatch(regex, email)):
        return True
    else:
        return False

email = input("Enter your email id - ")

if isValidEmail(email):
    username = email[0:email.index('@')]
    domain = email[email.index('@')+1: ]
    print("Username - ", username)
    print("Domain - ", domain)
else:
    print("Invalid Email!")
    
Publisher
Latest posts by Publisher (see all)

Publisher

Publisher @ideasorblogs

Leave a Reply