nomes = [" Paulo Ricardo ", " Fabio Junior ", " Roberto Carlos "]a = [nome.strip().split(' ')[0] for nome in nomes]print(a)
Standard input is empty
['Paulo', 'Fabio', 'Roberto']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!