Cartesian product of a list of sets in python

前端 未结 1 1113
萌比男神i
萌比男神i 2021-01-21 15:50

I had a list of sets. I do not know the length of the list apriori. I wanted to find the Cartesian product of the sets in the list in some code I\'m writing.

For example

1条回答
  •  臣服心动
    2021-01-21 16:13

    Use itertools.product(*list_of_sets).

    0 讨论(0)
提交回复
热议问题