ncycles¶
-
iteration_utilities.
ncycles
(iterable, n)¶ Returns the sequence elements n times.
- Parameters
- iterableiterable
Any iterable to repeat.
- n
int
Number of repetitions.
- Returns
- repeated_iterablegenerator
The iterable repeated n times.
Examples
>>> from iteration_utilities import ncycles >>> list(ncycles([1,2,3], 3)) [1, 2, 3, 1, 2, 3, 1, 2, 3]