class product(object):
"""
product(*iterables, repeat=1) --> product object
Cartesian product of input iterables. Equivalent to nested for-loops.
For example, product(A, B) returns the same as: ((x,y) for x in A for y in B).
The leftmost iterators are in the outermost for-loop, so the output tuples
cycle in a manner similar to an odometer (with the rightmost element changing
on every iteration).
To compute the product of an iterable with itself, specify the number
of repetitions with the optional repeat keyword argument. For example,
product(A, repeat=4) means the same as product(A, A, A, A).
product('ab', range(3)) --> ('a',0) ('a',1) ('a',2) ('b',0) ('b',1) ('b',2)
product((0,1), (0,1), (0,1)) --> (0,0,0) (0,0,1) (0,1,0) (0,1,1) (1,0,0) ...
"""
类产品(对象):
”“”
product(*iterables, repeat=1)——> product对象
输入迭代的笛卡尔积。相当于嵌套的for循环。
例如,product(A, B)对于A中的x和B中的y,返回的结果是相同的:((x,y)
最左边的迭代器在最外面的for循环中,因此输出元组
以类似里程表的方式循环(最右边的元素改变)
在每次迭代)。
要计算与自身的可迭代的乘积,请指定数字
使用可选的repeat关键字参数重复的。例如,
product(A, repeat=4)的含义与product(A, A, A, A)相同。
产品(“ab”范围(3))- - >(' a ',0)(' a ',1)(' a ',2)(' b ',0)(' b ',1)(' b ',2)
产品((0,1),(0,1),(0,1))- - >(0,0,0)(0,0,1)(0,1,0)(0,1,1)(1,0,0)…
”“”