mercredi 1 avril 2015

Remove prefix from name python


names = [
'LIC. SEBASTIÁN LASTIRI',
'ING. AGR. ROBERTO DANIEL RODRÍGUEZ',
'C.P.N. JULIO DOMINGO BURAK',
'INGENIERO HIDRÁULICO VÍCTOR AGUSTÍN PORRINO'
]


I have such list with names, i need to remove prefix like ('lic', 'c.p.n' etc) from name (this is just sample there is a lot of prefixes in such format)


output shell be like this :



'SEBASTIÁN LASTIRI'



I have tried to :



for i in names:
if '.' in i:
i.split('.')[1]


But it works only when there is one dot in prefix How to solve this


Aucun commentaire:

Enregistrer un commentaire