Python intersection and difference sum doesn't give me the actual number of the original set

前端 未结 3 1389
攒了一身酷
攒了一身酷 2020-12-22 00:30

I have two lists, one with old IDs and one with new IDs.

I want to get items in common and items not common.

The new_Items list has all new ones. The old_It

3条回答
  •  无人及你
    2020-12-22 01:08

    A-B gives items of A which are not in B B-A gives items of B which are not in A Either of these is not what you are looking for

    For items not common you need (A union B) minus (A intersection B) which is the symmetric difference of sets

    You can also get by "(A-B) union (B-A)"

提交回复
热议问题