I am trying to take two List of Lists and compare them against each other. From my research the closest I have found was this How to compare a list of lists/sets in python?. I am trying to do something just slightly different and may be heading down the wrong road and if so please feel free to point me in a better and more optimal direction. The first list will always be a baseline. It is what should be present in the second subset. So a huge bonus would be having the ability to know if the second list was missing the element or if the difference is due to a new element added to Second.
I have 2 Lists of lists I.E.
First = [['1', 'a', 'b', 'c'], ['2', 'a', 'b', 'c', 'd']]
Second = [['1', 'b', 'c'], ['2', 'a', 'b', 'c', 'd']]
The numbers are unique id's for the list. I could follow the above and get which ones are different as tuples but here is where the difference comes in. I am wanting the final result to retain the Unique id and then only the differences found. I.E Otherwise I am stuck searching hundreds of lines that have changed and could have changed in one of two places essentially doubling he search.
diff[['1', 'a', 'missing from second']]
the output can really be anything as long as I can retain unique id to data associated with it, and again the knowing whether it was missing or added in the second is more of a bonus but would help immensely. Also if tuples work better for this I could use the answer from the link above to use the map function.
for example of other way around
First = [['1', 'a', 'b'], ['2', 'a', 'b', 'c', 'd']]
Second = [['1', 'a', 'b', 'c'], ['2', 'a', 'b', 'c', 'd']]
diff[['1', 'c' 'added to second']
so I suppose if I were to keep track of the when it was added it might be better to have the output be below for each example given above. Again this is just me spitballing because I am not sure what is the most optimal way to do this.
diff_removed[['1', 'a']
diff_added[['1','c']