python 遍历的四种方法
dic1 = {'date':'2018.11.2','name':'carlber','work':"遍历",'number':3} for i in dic1: #遍历字典中的键 print(i) for key in dic1.keys(): print(key) for value in dic1.values(): #遍历字典中的值 print(value) for item in dic1.items(): #遍历字典中的元素 print(item) for i in dic1: print("该次循环得到的key为%s,得到的值为%s"%(i,dic1[i]))