Given a list
of URLs urls
of unknown length, I want to divide it into slices of 20 urls (plus the slice containing the remainder, if there is one). So if it contains 96 URLS, I'll have a 4 slices of 20, and a slice of 16. Also if the length is less than 20, obviously the list itself is the only slice.
Given:
quotient = len(urls) / 20
remainder = len(urls) % 20
Then:
if len(urls) / 20 == 0:
slice = urls
else:
numberOfSlices = (quotient + 1) if remainder !=0 else quotient
From here, I can start constructing the individual slices. But it's all starting to feel a little convoluted. Is there a more efficient (perhaps with NumPy) way of achieving this?