In []: Test=dict (x=1,y=2,z=3) in [71]: testout[71]: {'x': 1,'y': 2,'Z': 3}in [[a=[]:'a','b','C']in [[b=[1,2,3]:]in [74]: Zip (A, b) out[74]: [('a', 1), ('b', 2), ('C'-R)]in [75]: dict (Zip (A, b)) out[75]: {'a': 1,'b': 2,'C': 3}
dict.clear () Delete all the elements in the Dictionary dict.copy () Returns a copy of the dictionary (shallow copy) Dict.fromkeys (seq,val=None) Creates and returns a new dictionary that is the key to the dictionary in the SEQ element, and Val does the initial value for all keys in the dictionary (default is None if this value is not provided) Dict.get (Key,default=None) For the key in the dictionary dict, return the value corresponding to it, if the dictionary does not exist return Nonedict.has_key (key) if the key (key) exists in the dictionary, returns True, otherwise returns False.dict.items () returns a list containing a dictionary (key, value) to a tuple Dict.keys () Returns a list containing the keys in the Dictionary Dict.iteritems () returns a dictionary element an iteration Dict.iterkeys () Returns a dictionary key iteration dict.itervalues () returns a dictionary of value iterations Dict.pop (Key[,default]) and a method get () similar to if the key key exists in the dictionary, deletes and returns Dict[key], Throws a Keyerror exception if the key key does not exist and does not give the default value. Dict.popitem () randomly deletes a key from the dictionary-value is similar todict.setdefault (Key,default=none) and Method set (), If the key key does not exist in the dictionary,it is assigned a value by dict[key]= default. Dict.update (DICT2) adds a dictionary dict2 key - value pair to the dictionary dictdict.values () Returns a list that contains all the values in the dictionary
Built-in functions for the Python dictionary