如何获取元素列表的所有不相交子集,并且如果将它们连接在一起,则与python中的初始列表相同?

Suppose, a set [0,1,2] How can I get all the list of sets that if join together, it results= [0,1,2] Those subsets could be,

[[0],[1],[2]]

[[0,1],[2]]

[[0],[1,2]]

[[1],[0,2]]

[[0,1,2]]

提前致谢。

评论