mylist = [ '0.45', '6.7', '0.3']
mylist = list(map(float, mylist))
print(mylist)
####################OUPUT#######################
[ 0.45, 6.7, 0.3]
[float(i) for i in lst]
import numpy as np
test = "5,4,3,2";
lst = test.split(",");#lst is list of strings
a = np.array(lst,dtype=np.float32) #convert to numpy array of floats
# Basic syntax:
[str(x) for x in list_of_floats]
# Example usage:
list_of_floats = [1.2, 1.7, 3.141592654]
[str(x) for x in list_of_floats]
--> ['1.2', '1.7', '3.141592654']