python http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in相关的知识,希望对你有一定的参考价值。

def chunks(l, n):
    """Yield successive n-sized chunks from l."""
    for i in range(0, len(l), n):
        yield l[i:i + n]
        

以上是关于python http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in的主要内容,如果未能解决你的问题,请参考以下文章