I have a class with 2 attributes which are lists themselves:
class data...:
list1 = [["g1", 2.0], ["x1", 3.0]...] # n elements
list2 = [[2, 4, 5],[3, 2, 1]...] # n elements
I need to zip sort both lists, based on value of the second element of list2.
zipped = zip(dataobj.list1, dataobj.list2)
zipped.sort(cmp = lambda k: dataobj.list2[2])
This seems to not work.
How do I reference the second element of dataobj.list2[2] as this is not working and gave me the following error:
TypeError: <lambda>() takes exactly 1 argument (2 given)
zipped.sort(key = lambda k: k[1][1])?