This is my code, using Python 2.7
list1 = [1,2,3,4,5,6,9,10.....1000]
I'm trying to create chunks of 500 list data like this
chunk_data = [(1,2,3,4,5,...500),(501,502....1000)]
and then I'm going to add a "data" at the end of each chunk
so it will look like this
[(1,2...500,'data'),(501,502...1000,'data')]
I tried to use zip for this
it = iter(list1)
chunked_data = zip(*[it]*500)
but I'm unable to append the "data" now
from itertools import repeat
chunked_data = zip(*[it]*500,repeat("data")) #Gives Error about adding arguments after unpacking function values !!
It's not possible for me to write this code below even though it would work
chunked_data = zip(it,it,it...(500 times),repeat("data")]
So how should I attempt this?