Python program to split a list every Nth element code example
Example: split list on every nth element python
def chunks(list_in, n):
# For item i in a range that is a length of l,
for i in range(0, len(list_in), n):
# Create an index range for l of n items:
yield list_in[i:i+n]
# then just do this to get your output
list(chunks(our_list, cut_every))