把索引和内容一起输出
alist = ['a','b','c','d']
for idx, val in enumerate(alist):
print(idx, val)
输出:
0 a
1 b
2 c
3 d
2024-03-11 19:06:07
把索引和内容一起输出
alist = ['a','b','c','d']
for idx, val in enumerate(alist):
print(idx, val)
输出:
0 a
1 b
2 c
3 d