i have an array and fill it like this
arr = [[],[]]
arr[0].append(post.attrib['href']) #strings
arr[1].append(int(klass)) # int
and i need to sort whole array by arr[1] for example input:
[['string3', 'string45', 'string25'], [46, 2, 12]]
and output:
[['string45', 'string25', 'string3'], [2, 12, 46]]
i tried
arr[0].sort(key = x[1].__getitem__)
arr[0].sort(key=lambda x: x[1])
arr = sorted(arr, key=itemgetter(1))
but everything of this isn't working correct