key
-
[Python] - Dictionary개발/Python 2022. 7. 27. 12:17
Dictionary type is immutable key and mutable value mapping not sorted set No index , so access the key Syntax # Default type {"a" : 1, "b":2} e = {} f = dict() newdict = dict( alice = 5, bob = 20, tony= 15, suzy = 30) Key is not allowed mutable key like list , set , dict # Error case a = { {1, 3}: 5, {3,5}: 3} #set a = {[1,3]: 5, [3,5]: 3} #list a = { {"a":1}: 5, "abc": 3} #dict # Key immuttable..