title: What is the way to separate range and pass the array to the function?
body: <p>I have array of <code>attachmentList</code> and</p>
  
  <p>if I do</p>
  
  <pre><code>len(attachmentList) 
  </code></pre>
  
  <p>the result is 199930; 
  and I would like to send 999 elements each time to  api_request(attachment) function</p>
  
  <p>so pseudo code will be like this</p>
  
  <pre><code>count=0
  for (i=0,i&lt;len(attachmentList),i++)
       count++
       if count=999:
         api_request(attachmentList[i-999:i])
         count=0
  </code></pre>
  
  <p>What is the way to write for loop or there is another solution for that.</p>