Have a list with numeric strings, like so:
numbers = ['1.2', '5.6', '1'];
Would like to convert first two list elements to float, and last element to int:
numbers = [1.2, 5.6, 1];
Is there any one liner/elegant way of doing?
currently I'm doing with:
numbers = [ float(x) for x in numbers ]
numbers[-1] = int(numbers[-1])
or
functions = [float, float, int]
results = [func(arg) for func, arg in zip(functions, numbers)]