ls = ['a', 'b', 'c'] # method 1 for i in range(len(ls)): print(i, end = ' ') # print(i) print(ls[i]) # method 2 for s in ls: print(ls.index(s), end=' ') print(s) # method 3 for i, s in enumerate(ls): print(i, end=' ') print(s)
=============================================================
0 a
1 b
2 c
0 a
1 b
2 c
0 a
1 b
2 c
标签:end,Day6,a1,Python,Range,ls,b2,enumerate,print From: https://www.cnblogs.com/leishu/p/16868992.html