To iterate over the indices of a sequence, combine range() and len()
a = ['Mary', 'had', 'a', 'little', 'lamb'] for i in range(len(a)): print i, a[i]