List in List Comparison in Python

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


List in List Comparison in Python



I have 2 list which are again inside a list .want to compare and get the difference . The first list of A need be compared with the first list of B and so on.


a = [[' sh run vlan 1770', '', '', '', '!Command: show running-config vlan 1770', '!Time: Sun Jul 29 10:21:42 2018', '', 'version 7.1(4)N1(1c)', 'vlan configuration 1770', 'vlan 1770', ' name Finance', ' mode VPC', '', '', 'TEST1# ', '', '', 'TEST1#'], [' sh run vlan 1777', '', '', '', '!Command: show running-config vlan 1777', '!Time: Sun Jul 29 10:21:43 2018', '', 'version 7.1(4)N1(1c)', 'vlan configuration 1777', 'vlan 1777', ' name HR', ' mode VPC', '', '', 'TEST1# ', '', '', 'TEST1#']]
b = [[' sh run vlan 1770', '', '', '', '!Command: show running-config vlan 1770', '!Time: Sun Jul 29 10:21:46 2018', '', 'version 7.1(4)N1(1c)', 'vlan 1770', ' name Finance', ' mode VPC', '', '', 'TEST2# ', '', '', 'TEST2#'], [' sh run vlan 1777', '', '', '', '!Command: show running-config vlan 1777', '!Time: Sun Jul 29 10:21:46 2018', '', 'version 7.1(4)N1(1c)', 'vlan 1777', ' mode VPC', '', '', 'TEST2# ', '', '', 'TEST2#']]



basically concerned about vlan number ,name and mode .for e:g


'vlan 1770', ' name Finance', ' mode VPC'



so its a match , dont need the output .If its a mismatch then it needs to return the all 3 element.for e:g in this list "name HR" is missing in list b. so EXPECTED OUTPUT:


Missing in b:
--------------
vlan 1777
name HR
mode VPC









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

5FLn5slnOC9EU,UAqKgZR,CqSqQFW7 mp
431t,SAm3qz yU9AVHbpHvHZCz05rK,dscN,t AqsWrtTPA

Popular posts from this blog

Makefile test if variable is not empty

Visual Studio Code: How to configure includePath for better IntelliSense results

Will Oldham