I have a list of string numbers as follow:
my_list = ["6.84", "6", "3.24"]
and I expect to find a simple solution for convert those numbers which are in string format to digit format:
my_list = [6.84, 6, 3.24]
What I have tried:
l = [float(num) if '.' in num else int(num) for num in my_list]
I am wondering if there is a more straight forward solution in python?