📌  相关文章
📜  将列表拆分为多个列表 python - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:16.735000             🧑  作者: Mango

代码示例1
def split_list(a_list, number):
    splitNumber = len(a_list) // number
    result = [a_list[x:x+splitNumber] for x in range(0, len(a_list), splitNumber)]
    if(len(result) > number):
      result[len(result) - 2] = result[len(result) - 2]+ result[len(result)-1]
      result.pop()
    return result

a = [i for i in range(11)]
print(split_list(a,3))