roundrobin

sknano.core.itertools.roundrobin(*iterables)[source] [edit on github][source]

Yields an item from each iterable, alternating between them.

Recipe credited to George Sakkis

Examples

>>> from sknano.core import roundrobin
>>> list(roundrobin('ABC', 'D', 'EF'))
['A', 'D', 'E', 'B', 'F', 'C']