I am trying to sort a list of tuples based on another list of tuples by a key in that list.
Say I have the following:
list1 = [(5, 'something'),(2,'bobby'),(9,'suzy'),(6,'crab')]
list2 = [('something','othervalues'),('suzy','stuff'),('bobby','otherthings')]
And from this I would receive the output soring on the first element of each tuple in list1.
sorted = [('suzy','stuff'),('something','othervalues'),('bobby','otherthings') ]
So essentially it performs an intersection and then sorts on the remaining values by the first element in the tuple of list1.
I am not sure how to go about this, so any help would be great.