Python – Splitting a person’s name into forename and surname


ok so basically I am asking the question of their name
I want this to be one input rather than Forename and Surname.

Now is there any way of splitting this name? and taking just the last word from the "Sentence" e.g.

name = "Thomas Winter"
print name.split() 

and what would be output is just "Winter"

Best Solution

You'll find that your key problem with this approach isn't a technical one, but a human one - different people write their names in different ways.

In fact, the terminology of "forename" and "surname" is itself flawed.

While many blended families use a hyphenated family name, such as Smith-Jones, there are some who just use both names separately, "Smith Jones" where both names are the family name.

Many european family names have multiple parts, such as "de Vere" and "van den Neiulaar". Sometimes these extras have important family history - for example, a prefix awarded by a king hundreds of years ago.

Side issue: I've capitalised these correctly for the people I'm referencing - "de" and "van den" don't get captial letters for some families, but do for others.

Conversely, many Asian cultures put the family name first, because the family is considered more important than the individual.

Last point - some people place great store in being "Junior" or "Senior" or "III" - and your code shouldn't treat those as the family name.

Also noting that there are a fair number of people who use a name that isn't the one bestowed by their parents, I've used the following scheme with some success:

Full Name (as normally written for addressing mail); Family Name; Known As (the name commonly used in conversation).


Full Name: William Gates III; Family Name: Gates; Known As: Bill

Full Name: Soong Li; Family Name: Soong; Known As: Lisa