top of page
learn_data_science.jpg

Data Scientist Program

 

Free Online Data Science Training for Complete Beginners.
 


No prior coding knowledge required!

Simple Python app: Email splitter for separating the username and domain name

Writer's picture: TEMFACK DERICKTEMFACK DERICK

In my last Flask app, I needed to create a unique directory in /tmp directory for each user to perform some operations. In this case, as I have the email of each user when they log in, I decide to create a unique directory base on that email.


The valid format of the email address consists of a set of usernames follow by @ symbol and ends with a domain name. Know that, I split user email address based on @ symbol and use the username to create user directory and subdirectory.


I wrote a simple function that takes an email and returns a list of usernames and domains respectively so that I can use the part I want.



def split_email(email):
    return email.split('@')

As an email address is a string, we use the split function offer by the String class to split a string with a divider and return us a list of the element. Test of our function gives us the following result.


split_email('test@example.com')

output : ['test', 'example.com']

This type of function can be useful in certain case. This is github repo



1 comment

Recent Posts

See All

1 Comment


Aina Adekunle
Aina Adekunle
Sep 10, 2021

Use code snippets instead of images to insert your code in posts. And provide link to the GitHub repo.


Like

COURSES, PROGRAMS & CERTIFICATIONS

 

Advanced Business Analytics Specialization

Applied Data Science with Python (University of Michigan)

Data Analyst Professional Certificate (IBM)

Data Science Professional Certificate (IBM)

Data Science Specialization (John Hopkins University)

Data Science with Python Certification Training 

Data Scientist Career Path

Data Scientist Nano Degree Program

Data Scientist Program

Deep Learning Specialization

Machine Learning Course (Andrew Ng @ Stanford)

Machine Learning, Data Science and Deep Learning

Machine Learning Specialization (University of Washington)

Master Python for Data Science

Mathematics for Machine Learning (Imperial College London)

Programming with Python

Python for Everybody Specialization (University of Michigan)

Python Machine Learning Certification Training

Reinforcement Learning Specialization (University of Alberta)

Join our mailing list

Data Insight participates in affiliate programs and may sometimes get a commission through purchases made through our links without any additional cost to our visitors.

bottom of page