【发布时间】:2011-11-13 18:27:33
【问题描述】:
为什么 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' ... ]
【问题讨论】:
标签: python python-3.x