Introduce the product function through from itertools import product.
The Product function can realize the Cartesian product of the matrix
import itertools
for item in itertools.product([1,2],[10,20]):
print(item)
'''
(1, 10)
(1, 20)
(2, 10)
(2, 20)
'''
iterables are iterable objects, and repeat specifies that iterable repeats several times, namely:
product(A,repeat=3)等价于product(A,A,A)
product('ABCD', 'xy') --> Ax Ay Bx By Cx Cy Dx Dy
product(range(2), repeat=3) 等价于product([0,1],[0,1],[0,1])
--> 000 001 010 011 100 101 110 111