Question : split into list into even chunks
Answered by : tender-toucan-cf32s9kwijxl
def chunks(l, n): n = max(1, n) return (l[i:i+n] for i in range(0, len(l), n))
Source : https://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks | Last Update : Sat, 05 Jun 21
Question : split long list into chunks of 100
Answered by : ketan-92da92wpxy45
def chunks(lst, n): """Yield successive n-sized chunks from lst.""" for i in range(0, len(lst), n): yield lst[i:i + n]
Source : https://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks | Last Update : Wed, 19 May 21