def grouper(n, iterable, padvalue=None):
# type: (int, Iterable[Any], Any) -> Iterable[Iterable[Any]]
"""grouper(3, 'abcdefg', 'x') --> ('a','b','c'), ('d','e','f'), ('g','x','x')"""
return izip_longest(*[iter(iterable)] * n, fillvalue=padvalue)
# ----------------------------------------------------------------------
# Functions to find an executable in the PATH, from:
# http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python
评论列表
文章目录