# coding:utf-8 # 列表遍历 a = ['小哥','小二','小四','小五'] for i,value in enumerate(a): print(i,value) # 0 小哥 # 1 小二 # 2 小四 # 3 小五 #字典遍历 b = {'name':'小吴','age':18,'high':165} for index,key in enumerate(b): print(index,key) # 0 name # 1 age # 2 high for key,value in b.items(): print(key,value) # name 小吴 # age 18 # high 165