Created
June 6, 2018 18:38
-
-
Save TomColBee/4cf607f2e5b0e7b703b4d343d6a6c4e8 to your computer and use it in GitHub Desktop.
Python Bible: Email Slicer - String Index, Format and Print
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get user email address | |
email = input("What is your email address?: ").strip() | |
# Slice out the user name | |
user_name = email[:email.index("@")] | |
# Slice the domain name | |
domain_name = email[email.index("@")+1:] | |
# Format message | |
output = "Your username is '{}' and your domain name is '{}'".format(user_name,domain_name) | |
# Display output message | |
print(output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
import re
def recog():
x = input('enter name and email: ')
match = re.search(r'@[\w-]+', x)
email = match.group(0)
e = email[1:]
print('Oh nice, I see your mail is a', e)