1.列表取值(1)每次取3个

a = [1, 2, 3, 4, 5, 6, 7]step = 3for i in range(0, len(a), step): print(a[i:i+step])

打印结果:

[1, 2, 3][4, 5, 6][7]