hello again,
i am trying to get my head around this but without success, here is what

i have so far:

>>> list1 = [{'is_selected': False, 'id': 'AAC', 'title': 'Association of Airline Cons.'}, {'is_selected': False, 'id': 'AALA', 'title': 'Adv. Activity Licence. Auth.'}, {'is_selected': False, 'id': 'ABPCO', 'title': 'Association of British Prof. Conf. Organisation'}, {'is_selected': True, 'id': 'ABTA', 'title': 'Association of British Travel Agents'}, {'is_selected': False, 'id': 'ABTOT', 'title': 'Association of Bonded Travel Organisation Trust'}, {'is_selected': False, 'id': 'AERA', 'title': 'Association of Europe Rail Agents'}]

>>> list2 = [{'affiliation': 'ABTA', 'affiliation_no': u'G3903'}, {'affiliation': 'AAC', 'affiliation_no': u'none'}]

>>> for dic1 in list1:
...     for dic2 in list2:
... diff = [k for k, v in dic1.iteritems() if v != dic2['affiliation']]
...     print k, v
...
is_selected False
is_selected False
is_selected False
is_selected True
is_selected False
is_selected False
>>>

what am i missing here, i would like to get a list of the diff between list1 and list2

again thanks in advance.
norman
                

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to