Skip to content

Instantly share code, notes, and snippets.

@apeyroux
Last active November 22, 2022 18:41
Show Gist options
  • Save apeyroux/0e5b8768736b3bcecd9f08f724595ede to your computer and use it in GitHub Desktop.
Save apeyroux/0e5b8768736b3bcecd9f08f724595ede to your computer and use it in GitHub Desktop.
from email.utils import parseaddr
import re
_, mail = parseaddr("Alexandre Px <titi.-.tata@toto.fr>")
if mail == '':
print("Adresse mail non valide")
else:
match = re.split(r'\.-\.', mail, 1)
if len(match) == 2:
emetteur, balu = match
print("Emetteur : " + emetteur)
print("BALU : " + balu)
else:
print("Adresse mail n'est pas une balu")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment