如何用Python通过枚举获取索引 / 值对 可以使用下面的脚本,遍历列表中的值及其索引。 list1=['a','b','c','d','e'] for idx,val in enumerate(list1): print('{0}:{1}'.format(idx,val)) #输出: # 0:a # 1:b # 2:c # 3:d # 4:e