dic = { ‘k1‘:‘v1‘, ‘k2‘:‘v2‘, ‘k3‘:‘v3‘ } #1 for key in dic.keys(): print(key) #2 for key in dic.values(): print(key) #3 for key in dic: print(key,dic[key]) #4 dic[‘k4‘] = ‘v4‘ print(dic) #5 dic.pop("k1") print(dic) #6 print (dic.get(‘k5‘)) #先获取该值如不为空则可删除 #7 print(dic.get(‘k2‘)) #8 print(dic.get(‘k6‘)) #9 dic2 = { ‘k1‘:‘v111‘, ‘a‘:‘b‘ } dic2.update(dic) print(dic2) #10 lis =[[‘k‘,[‘qwe‘,20,{‘k1‘:[‘tt‘,3,‘1‘]},89],‘ab‘]] #lis[0][1][2][‘k1‘][0] = ‘TT‘ #1 #print(lis) lis[0][1][2][‘k1‘][0] = lis[0][1][2][‘k1‘][0].upper() #2 print(lis)