I know this question has been covered many times but my requirement is different.
I have a list like: range(1, 26). I want to divide this list into a fi
range(1, 26)
Use numpy
>>> import numpy >>> x = range(25) >>> l = numpy.array_split(numpy.array(x),6)
or
>>> import numpy >>> x = numpy.arange(25) >>> l = numpy.array_split(x,6);
You can also use numpy.split but that one throws in error if the length is not exactly divisible.