Extract Domain Name from Email using Split
Incoming JSON Data to Python Operations
{
"email": "info@bizdata360.com"
}
Python Operations
#sending to input of operation
Responsedata = []
# Extract the value of the "email" key
email_value = pycode_data.get("email", "") # Default to an empty string if "email" is missing
def extract_domain(email):
# Split the email at '@' and get the domain part
domain = email.split('@')[-1].strip()
return domain
# Extract the domain
domain = extract_domain(email_value)
# Prepare the response as JSON
response = {
"companyDomain": domain # Domain name (e.g., bizdata360.com)
}
#sending to output of operation
pycode_data.update(response)
Outgoing data from Python Operation
{
"email": "info@bizdata360.com",
"companyDomain: "bizdata360.com"
}