Python‎ > ‎itertools‎ > ‎

itertools.repeat()

http://www.adilwaseem.com/

Introduction
Repeat the iterable to number.

Syntax
itertools.repeat(x,y)

Parameters
x=iterable
y=number

Example
The method return as:
 import itertools
x=(3, 4, 1, 2)
z=itertools.repeat(x,9)
for value in z: print(value)

Output
>>> 
(3, 4, 1, 2)
(3, 4, 1, 2)
(3, 4, 1, 2)
(3, 4, 1, 2)
(3, 4, 1, 2)
(3, 4, 1, 2)
(3, 4, 1, 2)
(3, 4, 1, 2)
(3, 4, 1, 2)
>>>

Comments