Dictionary Basics
| ID | 193 |
|---|---|
| Link Reference | Not set |
| Link Credits | Not set |
| Link Technical Documentation | Not set |
| PlCodelang | Python |
| PlGroup | Array |
| PlItemTitle | Dictionary Basics |
| Code | # empty dict myDict = {} # some static values myDict ={ "key1" : {"item1":"value1"}, "key2" : {"itemX":"valueY"}, "keyX" : {"item99":"value98"} } # update a key programmatically myDict.update({"key1" = {"item2":"new value"}}) # iterate for (key, subdict) in myDict.items(): current_key = key current_subdict = subdict # get an specific item subdict = myDict.get("key2") print subdict.get("itemX") # valueY |
| Result Example |