Say I have a list like this:
a = ['hello','1','hi',2,'something','3']
I want to convert the numbers in the list into float while keeping the strings.
I wrote this:
for i in a:
try:
i = float(i)
except ValueError:
pass
Is there a more efficient and neat way to do this?