def chunks ( iterable , n ) : for i in range ( 0 , len ( iterable ) , n ) : yield iterable [ i : i + n ]
iterate over chunksize in range python
Yield successive n - sized chunks from iterable object . https : // stackoverflow . com / a / 312464
def chunks(iterable, n):
    """Yield successive n-sized chunks from iterable object. https://stackoverflow.com/a/312464 """
    for i in range(0, len(iterable), n):
        yield iterable[i:i + n]