Sort a list of ints and floats with negative and positive values?
In addition to doublefelix,below code gives the absolute order to me from string.
siparis=sorted(siparis, key=lambda sublist:abs(float(sublist[1])))
I'm trying to sort a list of unknown values, either ints or floats or both, in ascending order. i.e, [2,-1,1.0] would become [-1,1.0,2]. Unfortunately, the sorted() function doesn't seem to work as it seems to sort in descending order by absolute value. Any ideas?