Don't forget to also checkout my second blog containing articles to all other related ICT topics!!

Thursday, May 3, 2012

Itertools repeat method explained

Itertools repeat makes an iterator that returns object over and over again. Runs indefinitely unless the times argument is specified.
from itertools import repeat

for ele in repeat('a', 4):
    print ele

a
a
a
a

No comments:

Post a Comment