Answers for "python itertools repeat()"

1

python itertools repeat()

# How to use it:
# repeat(var, amount)

# repeat() is basically like range() but it gives an extra arg for a var

from itertools import repeat

for x in repeat("Spam? Or Eggs?", 3):
    print(x)
> "Spam? Or Eggs?"
> "Spam? Or Eggs?"
> "Spam? Or Eggs?"
Posted by: Guest on August-22-2020

Python Answers by Framework

Browse Popular Code Answers by Language