我想尝试 itertools
模块中的 permutations
功能。但是每次我尝试实现它时,我都会收到以下错误:
代码:
from itertools import permutations
txt=permutations('SKIN')
print(txt)
输出:
<itertools.permutations object at 0x7fee48665950>
我尝试在命令提示符下使用命令 pip install itertools
但我一直收到错误消息:
ERROR: Could not find a version that satisfies the requirement itertools (from versions: none)
ERROR: No matching distribution found for itertools
如何安装软件包?
原文由 user12735269 发布,翻译遵循 CC BY-SA 4.0 许可协议
itertools 是内置模块,无需安装:
permutations(<iterable>)
返回一个生成器,它产生可迭代元素的连续 r 长度排列:所需排列列表: