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 = "[email protected]"
- email2 = "[email protected]"
- print(mask_email(email1)) # Output: e*****[email protected]
- print(mask_email(email2)) # Output: j*****[email protected]
Advertisement
Add Comment
Please, Sign In to add comment