Given a number I want to split it separate but even-ish list which I can do :
import numpy as np
pages = 7
threads = 3
list_of_pages = range(1,pages+1)
page_list = [*np.array_split(list_of_pages, threads)]
Returns:
[array([1, 2, 3]), array([4, 5]), array([6, 7])]
I would like it to return a list of lists instead, ie:
[[1,2,3],[4,5],[6,7]]
I was hoping to do something like this (below doesnt work):
page_list = np.array[*np.array_split(list_of_pages, threads)].tolist()
is that possible or do I need to just loop through and convert it?
np.array_splitto evenly split the list. @user2357112numpy.array_split([1, 1.0, '1'], 2)converts the numbers to strings.