change values of array in dictionary

hakim ouaras hakim_ouaras at yahoo.com
Sun Jan 20 11:35:52 EST 2008


Hi all,

I have two dictionays like these:
dict1={"id1":[1,2,3,4,5],"id2":[1,2,3,1,3], "var1":[10,11,12,13,14]}
dict2={"id2":[1,2,3,4,], "var2":[20,21,22,23]}
I want to replace the values of dict1["var1"] with those of dict["var2"] with taking count the correspondance between dict1["id1"]  and dict2["id2"].

result that I want to have is like this:
dict1={"id1":[1,2,3,4,5],"id2":[1,2,3,1,3], "var1":[20,21,22,20,22]}

Are there any predefined python function to do this.

Thak you for your answers
Hakim









      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080120/11ccd043/attachment.html>


More information about the Python-list mailing list