标签: python list
我正在寻找一种方法将列表分成n个子列表
n
例如,如果
A = [0,1,2,3,4,5,6,7,8,9]
如果n = 4我需要4个不同的子列表
n = 4
B = [0,1,2] C = [3,4,5] D = [6,7,8] E = [9]
但最后一个子列表不能大于前一个,所以这不会做
B = [0,1] C = [2,3] D = [4,5] E = [6,7,8,9]