take¶
-
sknano.core.itertools.
take
(n, iterable)[source] [edit on github][source]¶ Return first n items of the iterable as a list.
Parameters: - n (
int
) – - iterable (
collections.abc.Iterable
) –
Returns: Return type: Examples
>>> from sknano.core import take, tabulate >>> t = tabulate(lambda i: i) >>> take(5, t) [0, 1, 2, 3, 4] >>> take(5, t) [5, 6, 7, 8, 9]
- n (