import itertools
list(itertools.combinations('abc', 2))
#[('a', 'b'), ('a', 'c'), ('b', 'c')]
list(itertools.permutations('abc',2))
#[('a', 'b'), ('a', 'c'), ('b', 'a'), ('b', 'c'), ('c', 'a')('c', 'b')]
python之permutations和combinations的区别
最新推荐文章于 2025-02-06 22:58:58 发布
