A Combinations of Items in Given List
- by mecablaze
Hello stackoverflow,
I'm currently in Python land. This is what I need to do. I have already looked into the itertools library but it seems to only do permutations.
I want to take an input list, like ['yahoo', 'wikipedia', 'freebase'] and generate every unique combination of one item with zero or more other items...
['yahoo', 'wikipedia', 'freebase']
['yahoo', 'wikipedia']
['yahoo', 'freebase']
['wikipedia', 'freebase']
['yahoo']
['freebase']
['wikipedia']
A few notes. Order does not matter and I am trying to design the method to take a list of any size. Also, is there a name for this kind of combination?
Thanks for your help!