a = [1,2,3,4,5,6,7,8,9,10,11] step = 3 b = [a[i:i+step] for i in range(0,len(a),step)]
>>> b [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11]]
https://blog.csdn.net/mr_cat123/article/details/80584988