product 用于求多个可迭代对象的笛卡尔积 (Cartesian Product)
可用于同时历遍循环多个对象
from itertools import product
l1 = ['a', 'b','c']
l2 = [1, 2, 3]
for i, j in product(l1, l2):
print(i, j)
输出:
product 用于求多个可迭代对象的笛卡尔积 (Cartesian Product)
可用于同时历遍循环多个对象
from itertools import product
l1 = ['a', 'b','c']
l2 = [1, 2, 3]
for i, j in product(l1, l2):
print(i, j)
输出: