python之permutations和

发布时间:2019-07-25 09:14:18编辑:auto阅读(2049)


    >>> 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')]
    >>>

关键字