itertools documentation code example
Example 1: itertools
from itertools import combinations
from itertools import permutations
Example 2: 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?"