get index in foreach py code example Example: get index in foreach py for idx, val in enumerate(ints): print(idx, val)