How to get the n next values of a generator into a list February 22, 2023 by Tarik Use itertools.islice: list(itertools.islice(it, n))