a=[1,0,1,0]
for i in a:
print i
This can print 1, 0, 1, 0. I want to print his array key value 0,1,2,3. How to do it
漂亮男人2017-06-12 09:24:57
Line number output (line number starts from 1)
my_list = ['a', 'b', 'c']
for idx, val in enumerate(my_list, 1):
print(idx, val)