【发布时间】:2021-02-07 00:21:29
【问题描述】:
我想挑战自己,我想构建一个像这样的关键字组合工具:
我想使用 Python 构建它,但我真的不知道如何将列表中的项目与另一个列表组合:
a = ['blue', 'red', 'green']
b = ['shoes', 'shirt', 'pants']
c = a + b
如果我打印 c 我会得到:
['blue', 'red', 'green', 'shoes', 'shirt', 'pants']
但我希望它可以这样组合:
- blue shoes
- red shoes
- green shoes
【问题讨论】:
-
参见“itertools.product”
-
对不起,正确的欺骗:Combinations of 2 lists
标签: python