enumerate英文翻译为枚举的意思。 可以将一个可遍历的数据对象组合为一个索引序列,同时列出数据和数据下标,一般用在 for 循环当中。
用法:

>>> name=["wuyou","chenwei","heweitao","qiuxiuwang"]
>>> list(enumerate(name))
[(0, 'wuyou'), (1, 'chenwei'), (2, 'heweitao'), (3, 'qiuxiuwang')]

for循环输出

>>> for i,n in enumerate(name):
print("the %s name is %s" % (i,n))


the 0 name is wuyou
the 1 name is chenwei
the 2 name is heweitao
the 3 name is qiuxiuwang