1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| thisdict = { "brand": "Porsche", "model": "911", "year": 1963 }
x = thisdict["model"] x = thisdict.get("model") thisdict["year"] = 2019
for x in thisdict.values(): print(x) for x, y in thisdict.items(): print(x, y)
thisdict["color"] = "red"
thisdict.pop("model") thisdict.popitem() del thisdict thisdict.clear()
mydict = thisdict.copy() dic = thisdict mydict = dict(thisdict)
child1 = { "name" : "Phoebe Adele", "year" : 2002 } child2 = { "name" : "Jennifer Katharine", "year" : 1996 } child3 = { "name" : "Rory John", "year" : 1999 }
myfamily = { "child1" : child1, "child2" : child2, "child3" : child3 }
|