Tuesday, 20 August 2013

Python Dictionary Update and Append

Python Dictionary Update and Append

i have a dictionary looking like this.
{"TIM" : [[xx,yy],[aa,bb]] , "SAM" : [[yy,cc]] }
I want to add a value [tt,uu] to "SAM" if not present yet in the set.
Also i want to add "KIM" with [ii,pp].
How can i do these things?
Thank you,
i have a solution with 2 if's , but is there a better one?

No comments:

Post a Comment