Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

divide array into equal parts/slices python

import more_itertools as mt
#Create an array and use chunked() method
iterable = range(11)
n = 3
list(mt.chunked(iterable, n))
# [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10]]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #divide #array #equal #python
ADD COMMENT
Topic
Name
3+6 =