List
list_a = [[1, 2],[3, 4], [5, 6]]
for index, item in enumerate(list_a):
# do something
Description of task required
My question is, how would I write this loop if I wanted to retrieve each seperate list within list_a as index 0 and 1. At the moment [1, 2] is index 0, [3, 4] is index 1 etc. But what I am chasing is the following:
[1, 2] would have 1 as index 0 and 2 as index 1, then I would perform some task and then move onto the following where [3, 4] would have 3 as index 0 and 4 as index 1 and perform the same task as before. Any help would be awesome! :)
for small_list in list_a:
for index, item in enumerate(small_list):
print index, item