I have a nested list of lists. I need to compare a top level list to the sub lists and save the duplicates of each list into a new list. I've tried set and list comprehensions but once I try to turn those into a loop to iterate through the lists I run into issues example data below with expected returns:
topList = [list1[1,2,3], list2[3,4,5], list3[5,6,7]]
listofVals = [1,4,7]
I would expect a return of a new list of lists containing resList[[1],[4],[7]]
, the intent is to replicate this with more data so the sample data here is simple to provide proof of concept. I normally work in C so pointer math and just deref'ing values to do a direct compare isn't viable for my application or if it is my python fu is not the best.