I am trying to separate the name from the domain name in python. I have gotten fairly close, however the output doesn't look quite right. This is what I have done thus far:
def get_name(email_list):
x = []
for name in email_list:
y, _, _ = name.partition("@")
split_name = y.split('_')
x.append(split_name)
return(x)
When I run this with this example of an input:
get_name(["arthur_blake@gmail.com", "bob_dylan@gmail.com"])
I get the following output:
[['arthur', 'blake'], ['bob', 'dylan']]
I want the output to look like so:
['Arthur Blake', 'Bob Dylan']
Any suggestions on how to fix this?