Jan-11-2018, 12:44 PM
Hey Folks,
i want to sort an array by numbers, like this array for example
I tried this code to sort the array, but now I have the problem that it doesn't work with the letters in my data.
Kind reguards,
M.D.B.
i want to sort an array by numbers, like this array for example
[['B', '-50', '-30', '-8', '1000'], ['T', '-60', '-180', '0', 'parts.dat'], ['T', '-160', '-160', '0', '40']]Now I want to sort the array by the second or third character, any of you has a idea how to?
I tried this code to sort the array, but now I have the problem that it doesn't work with the letters in my data.
data = [[int(c) for c in row] for row in data] data = sorted(tokenized, key=lambda x: x[1]) print(data)Hope anyone can help me with this :)
Kind reguards,
M.D.B.