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
|
del dict['Name']
dict.clear()
del dict
len(dict)
dict.fromkeys(seq[, val])
In [75]: d= dict.fromkeys([1,2,3],['a','b','c']) In [76]: d Out[76]: {1: ['a', 'b', 'c'], 2: ['a', 'b', 'c'], 3: ['a', 'b', 'c']}
dict.get(key, default=None)
dict.keys()
In [78]: d.keys() Out[78]: dict_keys([1, 2, 3])
In [79]: type(d.keys()) Out[79]: dict_keys
In [80]: list(d.keys()) Out[80]: [1, 2, 3]
dict.values() In [81]: d.values() Out[81]: dict_values([['a', 'b', 'c'], ['a', 'b', 'c'], ['a', 'b', 'c']])
pop(key[,default])
In [83]: d.pop(1) Out[83]: ['a', 'b', 'c']
popitem()
In [84]: d.popitem() Out[84]: (3, ['a', 'b', 'c'])
|