Program for separating the username and domain name of an email address with python

Configurare noua (How To)

Situatie

So we need to divide the email into two strings using ‘@’ as the separator. Let’s see how to separate the email and domain name with Python:

Backup

email = input("Enter Your Email: ").strip()
username = email[:email.index("@")]
domain_name = email[email.index("@")+1:]
format_ = (f"Your user name is '{username}' and your domain is '{domain_name}'")
print(format_)

Solutie

Tip solutie

Permanent

Voteaza

(1 din 2 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?