# Tuple elements can not change, add, delete the first stage element # tuple can not be modified, deleted, added # tuples are generally written, the last comma tu = (123, "wdsd" , 213, (213 , 213), [(31 is, "wdsd")], True, 43 is, 67,) # index V1 = TU [0] Print (V1) # slice V2 = TU [0: 2] Print (V2) # for loop iteration also can be subject # count acquisition times specified element appears in a tuple # index tuple specified in the initial and end positions of the number of occurrences for I in TU: Print (I) # tuples ordered v3 = tu [3 ] [0] Print (v3) # class dictionary dict # dictionary value can be any value # key addition to the dictionary lists and dictionaries, are # unordered dictionary # index ways to find the specified element # support del delete info = { " k1 ":" v1 ", # key of " K2 ":" V2 " } V4 = info [ 'k2'] Print (V4) # for loop for I1 in info.keys (): # traversing key Print (I1) for i2 in info.values (): # traversal value Print (i2) for i3, I4 in info.items (): # traversing key and value Print (I3, I4) # dictionary method # 1, clear clear # 2, copy shallow copy # 3, fromkeys, according to the sequence, to create the dictionary, and assign a uniform value v5 = dict.fromkeys ([ "k1" , "K2", "K3"], [123, 433, 456]) Print (V5) #. 4, according to the key value acquired when the key does not exist, can specify the default value (None) V6 = info.get ( "K2 ", 123) Print (V6) #. 5, and acquires the POP and remove popitem value V7 = v5.pop (" K1 ", 30) Print (V5, V7) V8, V9 = v5.popitem () Print (V5, V8 , V9) #. 6, setDefault set value is not set exists, acquires a value corresponding to the absence of setting v10 = info.setdefault("k3", "456") get, update, keys, values, five dictionary print(v10, info) # 7、update更新 info.update({'k1': '111', 'k4': '444'}) print(info) info.update(k1=100, k2=200,k5='wu') print(info) ############################ """ 重要的 keys() values() items() get() upadte() """ ################### 大整理 ########### """ false None, "", (), 0 1 index, slicing cycle (one element can not be deleted , add, modify) quad the index, slicing, cyclic append, extend, insert three lists replace, find, join, strip, two strings int A digital for loop, the index six Boolean value BOOL () "" "