#二进制法 def PowerSetBinary1(arg): size = len(arg) set_all = [] for i in range(2**size): tmp = [] for y in range(size): if (i>>y) % 2 : tmp.append(arg[y]) set_all.append(tmp) return set_all print(PowerSetBinary1([3,5,6]))
原文:https://www.cnblogs.com/director/p/12770478.html