I'm trying to compare each dictionary key with a values from list:
order = {
u'custom_attributes_desc': {u'text': u'Food truck', u'name': u'Bob', u'email': u'bob@yahoo.com'},
u'account_id': 12345,
u'state_desc': u'open',
u'start_dt': u'2013-07-25 15:41:37',
u'end_dt': u'2013-07-25 19:41:37',
u'product_nm': u'foo',
u'transaction_id': 12345,
u'product_id': 1111
}
match = ['transaction_id', 'account_id', 'product_nm']
not_matched_keys = [key_match for key_order, key_match in zip(order.keys(),match) if key_order != key_match]
And result I'm getting:
not_matched_keys
['transaction_id', 'account_id', 'product_nm']
But I would like to see
[]
Because matched keys are in dictionary.