I have a list of numbers that is subject to change. I would like to cut it up into chunks of 16, which is what the below accomplishes, but unless exactly divisible by 16 (not often), I get leftovers. I'd like to know how to output the remaining items after the bulk has been processed.
s = ["002","003","005","006","007","008","009","010","012","013","014","015","016","017","018","019","023","024","025","026","027","028","029","031","032","033","034","035","037","038","040","041","042","043","044","045","046","047","048","049","050","051","052","053","055","059","060","063","064","065","066","067","069","070","071","072","073","074","075","076","077","078","079","080","081","082","083","086","088","089","090","091","092","093","094","095","096","097","098","099","100","101","102","105","106","107","109","110","111","112","113","114","115","117","118","120","122","123","124","125","127","128","129","130","131","133","134","135","136","137","138","139","140","143","145","147","148","149","150","152","153","154","155","157","158","160","161","163","165","166","167","169","170","172","173","174","175","177","178","179","181","182","183","185","186","187","188","189","191","192","193","194","195","196","201","202","203","204","205","206","207","208","210","211","212","213","214","215","216","217","218","220","221","222","223","225","226","227","228","229","230","231","232","233","234","235","236","237","238","240","241","242","243","244","245","247","248","300","302"]
count = 0
store_count = []
for i in s:
count += 1
store_count.append(i)
if count % 16 == 0 :
print(store_count)
store_count = []
Output appears like so:
['207', '208', '210', '211', '212', '213', '214', '215', '216', '217', '218', '220', '221', '222', '223', '225']
['226', '227', '228', '229', '230', '231', '232', '233', '234', '235', '236', '237', '238', '240', '241', '242']