Skip to content

Instantly share code, notes, and snippets.

@nateluzod
Last active September 22, 2015 08:18
Show Gist options
  • Save nateluzod/ef82aec7ac659af082cd to your computer and use it in GitHub Desktop.
Save nateluzod/ef82aec7ac659af082cd to your computer and use it in GitHub Desktop.
Mask an email address to show only the first letter of the name and the domain. Could be modified to work the same for credit card numbers.
def scrub_email(email):
""" Takes an email address and masks the left side. test@test.com becomes t***@test.com """
user, domain = email.split('@')
user = user[0].ljust(len(user), "*")
return("{}@{}".format(user, domain))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment