<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
I have a dictionary which looks something like this:<br>
<font face="Courier New"><br>
elem =
{"co":[1,2,3],"cp":[3,2,1],"pp":[5,6,7],"cl":[1,2,3],"qw":[6,7,8],"qa":[8,7,6]}</font><br>
<br>
what Im trying to do is find all keys in the list that have the same
value and delete those (except one); thereby removing all redundant
keys so that the above dict will look like this:<br>
<font face="Courier New"><br>
elem = {"co":[1,2,3],"pp":[5,6,7],"qa":[8,7,6]}</font><br>
<br>
my code so far looks like this:<br>
<br>
<font face="Courier New, Courier, monospace">for out1 in elem.keys():<br>
    for out2 in elem.keys():<br>
        if out1 != out2:<br>
            elem[out1].sort()<br>
            elem[out2].sort()<br>
            if elem[out1] == elem[out2]:<br>
                del elem[out1]<br>
<br>
</font>This returns in a KeyError exception when sorting. What am I
missing here? <br>
Thanks<br>
Astan<br>
</body>
</html>