I have started by creating a list called namelist consisting of three names. First and last names are separated by space
namelist=["Emma Wild", "Liam Wilson", "Elijah Mason"]
To find the first names, I will find the space choose the first part [0] of the split and put the names into new list called firstnames.
firstnames = [name.split(' ')[0] for name in namelist]
firstnames
OUTPUT:
['Emma', 'Liam', 'Elijah']
To create lastnames list, use the same format, only selecting the part after the space [1]
lastnames = [name.split(' ') [1] for name in namelist]
lastnames
OUTPUT:
['Wild', 'Wilson', 'Mason']
Sur cette page du site, vous pouvez voir la vidéo en ligne Using split function to split words where an empty space is found durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Online Skills 12 juin 2017, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 102 fois et il a aimé 0 téléspectateurs. Bon visionnage!