首页
技术博客
登录
6mi
u
盘
搜
搜 索
技术博客
python -求排列
python -求排列
tech
2024-11-21
0
from
itertools
import
permutations
def
set_permu
(
s
,
n
)
:
c
=
permutations
(
s
,
2
)
return
list
(
c
)
s
=
{
1
,
2
,
3
}
n
=
2
set_permu
(
s
,
n
)
[
(
1
,
2
)
,
(
1
,
3
)
,
(
2
,
1
)
,
(
2
,
3
)
,
(
3
,
1
)
,
(
3
,
2
)
]
转载请注明原文地址:https://tech.qufami.com/read-19233.html
最新回复
(
0
)