python itertools product函数
2019獨角獸企業重金招聘Python工程師標準>>>
?product(*iterables) --> 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) ...
轉載于:https://my.oschina.net/zpengseu/blog/543437
總結
以上是生活随笔為你收集整理的python itertools product函数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: RTC是DS1339,驱动采用的是rtc
- 下一篇: js里规定输入的数值只能是数字