How to compare a list of lists/sets in python?

后端 未结 8 1793
情深已故
情深已故 2020-12-01 03:47

What is the easiest way to compare the 2 lists/sets and output the differences? Are there any built in functions that will help me compare nested lists/sets?

Inputs:

8条回答
  •  孤城傲影
    2020-12-01 04:19

    Note that with this method you will loose the order

    first_set=set(map(tuple,S))
    second_set=set(map(tuple,T))
    print map(list,list(first_set.union(second_set)-(first_set&second_set)))
    

提交回复
热议问题