The three quirky things are:
1) The results are returned in a dictionary (from both systems), whose values are a list of user attributes, and I'd like to compare either the username or the email fields in the list inside the dictionary (preferably email as it's required to be unique)
2) The format is 'clean' on one return - ie email@domain.com but in list form from another, ie ['email2@domain2.com'] (same with username) - not sure if this matters, it hasn't seemed to yet
3) there may be multiple email addresses. Only one is required to be unique, and one of the dictionaries may have multiple emails (though it is contained to a single source - say source 1's dictionary may have multiples, source 2's does not)
I've tried many things, what I'm looking at now is something like:
Expand|Select|Wrap|Line Numbers
- for key, value in data: #source2
- for k, v in result: # source1 (possibly multiple emails)
- for entry in value:
- #this now looks wrong to me, I might not need the for above, but it still doesn't work without...
- if entry.get("mail",[]) in v.get("mail",[]):
- print "Match"
- print value
- print v
- # eventually will join additional fields
- # eventually will write to file
- else:
- #doesn't match, skip for now
- pass