Answers for "python iterate through list by chunks"

0

python iterate through list by chunks

dict_list = [This is the list with 9000 dicts]
batch_list = []
return_list = []

for i in dictlist:
    batch_list.append(i)
    if len(batch_list)  == 100:
        return_list.append(API_CALL_FUNCTION(batch_list))
        batch_list.clear()

if batch_list:
    return_list.append(API_CALL_FUNCTION(batch_list))
Posted by: Guest on July-08-2021

Code answers related to "python iterate through list by chunks"

Browse Popular Code Answers by Language