I have 2 list of lists.
One is say list1
, which is :
[['1', '2', '*', '2', '1', '0.8'],
['1', '2', '3', '1', '1', '0.7'],
['*', '*', '3', '4', '1', '0.5'],
['1', '2', '*', '1', '1', '0.3'],
['2', '2', '*', '2', '1', '0.1']]
And list2
is :
[['3', '*', '1', '4', '1', '0.9'],
['1', '2', '2', '2', '1', '0.4'],
['2', '2', '*', '2', '1', '0.1']]
Now I want to get the union
of these 2 list of lists and create a 3rd list of list and as ['2', '2', '*', '2', '1', '0.1']
this list is there in both of them so I want this to be in the final list of list for only 1 time.
I am doing:
final_list=list1 + list2
Final list is producing :
[['3', '*', '1', '4', '1', '0.9'],
['1', '2', '*', '2', '1', '0.8'],
['1', '2', '3', '1', '1', '0.7'],
['*', '*', '3', '4', '1', '0.5'],
['1', '2', '2', '2', '1', '0.4'],
['1', '2', '*', '1', '1', '0.3'],
['2', '2', '*', '2', '1', '0.1'],
['2', '2', '*', '2', '1', '0.1']]
My desired outcome is :
[['3', '*', '1', '4', '1', '0.9'],
['1', '2', '*', '2', '1', '0.8'],
['1', '2', '3', '1', '1', '0.7'],
['*', '*', '3', '4', '1', '0.5'],
['1', '2', '2', '2', '1', '0.4'],
['1', '2', '*', '1', '1', '0.3'],
['2', '2', '*', '2', '1', '0.1']]