Sep-26-2018, 09:33 AM
HI
I have two list . i want to compare with each other with the list index[1][2][3] of each list with other list .If its a match then ignore , if not the return the whole list.
I have two list . i want to compare with each other with the list index[1][2][3] of each list with other list .If its a match then ignore , if not the return the whole list.
a = [['Eth1/1/13', 'Marketing', 'connected', '10', 'full', 'a-1000'], ['Eth1/1/14', 'NETFLOW02', 'connected', '10', 'full', '100']] b = [['Eth1/1/13', 'NETFLOW02', 'connected', '15', 'full', '100'], ['Eth1/1/14', 'Marketing', 'connected', '10', 'full', 'a-1000']]Expected Output :
Diff a: Eth1/1/14 NETFLOW02 connected 10 full 100 Diff b: Eth1/1/13 NETFLOW02 connected 15 full 100My Code :
p = [i for i in a if i not in b] for item in p: print item[0] print "\n++++++++++++++++++++++++++++++\n" q = [i for i in b if i not in a] for item in q: print item[0]Any idea ?