dict(mapping)# new dictionary initialized from a mapping object's (key, value) pairs
a =(1,2,3);b =('a','b','c')dict(zip(b,a))# {'a': 1, 'b': 2, 'c': 3}
dict(iterable)-> new dictionary initialized asif via:
d ={}for k, v in iterable:
d[k]= v
dict(**kwargs)-> new dictionary initialized with the name=value pairs in the keyword
argument list.dict(a=1, b=2)# {'a': 1, 'b': 2}
Return the value for key if key is in the dictionary, else default.(返回value或者default对应的值)
dict.items()
a set-like (类似于集合的)object providing a view on Dict’s items(条目)
dict.keys()
a set-like object providing a view on Dict’s keys(返回键)
dict.pop(k[,d])
remove specified key and return the corresponding value. If key is not found, d(任意对象) is returned if given, otherwise KeyError is raised.(删除指定键项)
dict.popitem()
没有参数。remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.(删除随机的一项)
dict.setdefault(key, default=None)
Insert key with a value of default if key is not in the dictionary.(插入键值)Return the value for key if key is in the dictionary, else default.
dict.update([E, ]**F)
Update D from dict/iterable E and F. (将E,F中所有项加入d中);If E is present and has a .keys() method,(字典) then does: for k in E: D[k] = E[k]; If E is present and lacks a .keys() method, (非字典)then does: for k, v in E: D[k] = v, In either case, this is followed by: for k in F: D[k] = F[k]