itertools
say it: “IT-er-toolz” /ˈɪtərˌtulz/
A standard module of ready-made looping tools.
What is itertools?
itertools is a standard module of ready-made looping tools: combining lists, making every pairing, grouping and more.
from itertools import product
sizes = ["S", "M"]
colors = ["red", "blue"]
for size, color in product(sizes, colors):
print(size, color) # S red, S blue, M red, M blue
Level: Freelancer · More Python terms at this level
Updated