我怎样才能得到(以一种非常有效的 python 方式),一组包含在另一个长列表中的子列表??,我用例子解释:
假设我有这个:
List = [[1,2,3],[4,5,6],[7,8,9],[2,4,3],......long list]
我想获得一个将子列表分组的输出,比如说,在一组 7 个子列表中,那么输出将如下所示:
L1 = [1,2,3]
L2 = [4,5,6]
L3 = [7,8,9]
up to L7
then process those 7 lists separately
and then start again....
L1 = [x,x,x] this L1 would be (obviously) the 8th sub-list in the big list "List"
L2 = [x,x,x] this would be the 9th sub-list....and so on
我不知道我是否应该这样称呼它,但这就像制作 7 个子列表的“块”。
是否有可能以快速有效的方式进行?