Hello, I am new to Python and would be verry happy if someone would give me the code for a function that yields all sublists of a list. I need it for later implemetation in C, where I have to do work on these sublists.
I would need something like this:
def printSubs(l):
for p in sublists(l):
print p # just for test
def sublists(l):
# now this is the part I can't figure out :(
So the result of printSubs([1,2,3])
would be as follows
[1]
[2]
[3]
[1,2]
[1,3]
[2,3]
[1,2,3]
The order is not important!
Thanks for any help!