enumerate 模块

import os

list1 = ['a','b','c']

for index,aph in enumerate(list1)
#把可遍历对象的数据以及其索引取出分别赋值给index,aph

print(index,aph)

猜你喜欢

转载自www.cnblogs.com/Hale-wang/p/10268397.html