>> from scipy.special import comb, perm >> perm(3, 2) 6.0 >> comb(3, 2) 3.0
>> from itertools import combinations, permutations
>> permutations([1, 2, 3], 2)
<itertools.permutations at 0x7febfd880fc0>
# 可迭代对象
>> list(permutations([1, 2, 3], 2))
[(1, 2), (1, 3), (2, 1), (2, 3), (3, 1), (3, 2)]
>> list(combinations([1, 2, 3], 2))
[(1, 2), (1, 3), (2, 3)] 以上就是Python中排列组合计算操作的实现示例的详细内容,更多请关注Gxl网其它相关文章!
查看更多关于Python中排列组合计算操作的实现示例的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did81706