Python Itertools.Permutations()
发布于 2021-01-29 17:45:18
为什么itertools.permutations()返回每个排列的字符或数字列表,而不仅仅是返回字符串?
例如:
>>> print([x for x in itertools.permutations('1234')])
>>> [('1', '2', '3', '4'), ('1', '2', '4', '3'), ('1', '3', '2', '4') ... ]
为什么不返回此?
>>> ['1234', '1243', '1324' ... ]
关注者
0
被浏览
51
1 个回答