+ 4

How to get numbеrs from list of strings

listee = str['pol 1', 'lon 2.4', 'pol 3', 'lon 2.0'] print (eval(listee))

15th Feb 2018, 6:30 AM
Sasha Kozachok
Sasha Kozachok - avatar
5 Respostas
15th Feb 2018, 10:00 AM
David Handl
David Handl - avatar
+ 3
What is your expected output? is it listeenum = [1,2.4,3,2]
15th Feb 2018, 6:48 AM
Louis
Louis - avatar
+ 2
i need to get list with int and floats from this list for instance. how can i do it?
15th Feb 2018, 6:47 AM
Sasha Kozachok
Sasha Kozachok - avatar
+ 2
eval doesn't work
15th Feb 2018, 6:47 AM
Sasha Kozachok
Sasha Kozachok - avatar
+ 1
for word in listee: newlist.append(word.split[1])
15th Feb 2018, 6:55 AM
Oma Falk
Oma Falk - avatar