I have a function that should get parts from a list and than move in the list to get the next part or part:
def batch(iterable, n=1):
l = len(iterable)
for ndx in range(0, l, n):
yield iterable[ndx:min(ndx + n, l)]
I've tried to use this function as followed :
.............................
index =0;
values.clear()
for i in batch(my_data, 40):
values.append(i)
index = index +1
print('index', index )
UPDATE
what I'm seeing is that index value reaches 58 or 20, while I'm expecting 40
thanks in advance !