Python Itertools.Permutations()

前端 未结 4 1798
离开以前
离开以前 2020-12-09 07:47

Why does itertools.permutations() return a list of characters or digits for each permutation, instead of just returning a string?

For example:

>&g         


        
4条回答
  •  半阙折子戏
    2020-12-09 08:24

    Because it expects an iterable as a parameter and doesn't know, it's a string. The parameter is described in the docs.

    http://docs.python.org/library/itertools.html#itertools.permutations

提交回复
热议问题