Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- def mask_email(email):
- parts = email.split('@')
- username = parts[0]
- domain = parts[1]
- masked_username = username[0] + '*****' + username[-1]
- masked_email = masked_username + '@' + domain
- return masked_email
- # Example usage
- email1 = "example.email@gmail.com"
- email2 = "john.doe@example.com"
- print(mask_email(email1)) # Output: e*****l@gmail.com
- print(mask_email(email2)) # Output: j*****e@example.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement