Hrm, so if I have this right then your looking for something like this:
a = [['vlan 158', ' name MARKET', ' mode vpc']] b = [['vlan 158', ' name MARKETING', ' mode vpc'], ['vlan 159', ' name SALES', ' mode vpc']] def check_contents(list_one, list_two): shorter, longer = sorted([list_one, list_two], key=len) for x in longer: if not x: continue for y in shorter: if not y: continue if x[0] != y[0]: print(x) check_contents(a, b)Output:
['vlan 159', ' name SALES', ' mode vpc']