📜  python group groupe of 2 - Python 代码示例

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

代码示例1
def grouper(iterable, n, fillvalue=None):
    "Collect data into fixed-length chunks or blocks"
    # grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx"
    args = [iter(iterable)] * n
    return zip_longest(*args, fillvalue=fillvalue)