Hi Tutors, Background:
1. I have a dictionary with 4 keys and some repeated values for each key. >>> dida {'NM_001033044': [32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32843894, 32843894, 32843894, 32843894, 32843894, 32843894, 32843894, 32843894, 32843894, 32843894, 32844846, 32844846, 32844846, 32844846, 32844846, 32844846, 32844846, 32844846, 32844846, 32844846, 32845745], 'NM_002065': [32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32843894, 32843894, 32843894, 32843894, 32843894, 32843894, 32843894, 32843894, 32843894, 32843894, 32844846, 32844846, 32844846, 32844846, 32844846, 32844846, 32844846, 32844846, 32844846, 32844846, 32845745], 'NM_015701': [32844783, 32844783, 32844783, 32844783, 32844783, 32844783], 'NM_001033056': [32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32843894, 32843894, 32843894, 32843894, 32843894, 32843894, 32843894, 32843894, 32843894, 32843894, 32844846, 32844846, 32844846, 32844846, 32844846, 32844846, 32844846, 32844846, 32844846, 32844846, 32845745]} In the case of 'dida', the list of values have repeated elements. So I got rid of duplicates in the value lists (value as in key:value pair) in the case of 'didi' >>> didi {'NM_001033044': [32842023, 32843894, 32844846, 32845745], 'NM_002065': [32844846, 32842023, 32845745, 32843894], 'NM_015701': [32844783], 'NM_001033056': [32843894, 32844846, 32845745, 32842023]} Question: 1. How can I get A^B^C^D(^ = intersection) where A, B, C and D are keys from dida or didi. 2. How can I store values generated dynamically. For example, here in 'dida' I know there are 4 keys, but how can I create 4 lists while running in for loop and store the key values in 'dida'. Do I have to write an class object that will create empty lists depending on number of keys a dictionary has? I am loosing my mind because I do not know how to store the values for each key in a loop and do set operations. For instance, I tried the following way: >>> for m in range(len(didi.keys())): ... x = m+1 ... a = Set(didi[didi.keys()[m]]) ... print a ... Set([32845745, 32844846, 32843894, 32842023]) Set([32845745, 32843894, 32844846, 32842023]) Set([32844783]) Set([32845745, 32844846, 32843894, 32842023]) I would be happy, if I could store all 4 sets (above)into listsor sets A, B, C and D and do (A^B)^(C^D). Could any one help me please. My ultimate goal is to do set operations on this dictionary. If things get more complicated, I will seek R's help through RPy. Thanks __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor