Re: comparing dictionaries to find the identical keys

2007-12-28 Thread Christian Heimes
Beema shafreen wrote: > hi everybody , > i need to compare two dictionary's key. I have written a script Use sets. Sets are easier to use and much faster: >>> d1 = {'a': 1, 'b': 2, 'c': 3} >>> d2 = {'b': 2, 'c': 3, 'd': 4} >>> d1.keys() ['a', 'c', 'b'] >>> d2.keys() ['c', 'b', 'd'] >>> s1 = set(

Re: comparing dictionaries to find the identical keys

2007-12-28 Thread km
Hi On Dec 28, 2007 4:55 PM, Beema shafreen <[EMAIL PROTECTED]> wrote: > hi everybody , > i need to compare two dictionary's key. I have written a script > gene_symbol = {} > probe_id = {} > result = {} > def getGene(fname): > fh = open(fname , 'r') > for line in fh: >