getting all possible combinations of a list in a form of sublists
问题 I wonder if someone can help with the following task: What is the way to get all combinations a list can be split into sublists, when order does not matter? Let's say I have a list of 4 items: import itertools as it a = [1, 2, 3, 4] print(list(it.combinations(a, 2))) That will give me a list of 6 possible pairs: [(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)] How to make (out of it? or any other way) a set of lists that contain original [1, 2, 3, 4] sequence in any order? So for this example