def permutation(x): if len(x) == 0 or len(x) == 1: return [x] result = [] for i in x: temp = x[:] print temp temp.remove(i) tempx = permutation(temp) for j in tempx: j[0:0] = [i] result.append(j) return result
Python实现全排列
最新推荐文章于 2024-08-16 20:56:42 发布