Python Itertools.Permutations()

前端 未结 4 1782
离开以前
离开以前 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条回答
  •  Happy的楠姐
    2020-12-09 08:34

    I have not tried, but most likely should work

    comb = itertools.permutations("1234",4)
    for x in comb: 
      ''.join(x)    
    

提交回复
热议问题