【发布时间】:2014-09-11 05:51:07
【问题描述】:
我正在尝试合并 2 个列表并希望形成组合。
a = ['ibm','dell']
b = ['strength','weekness']
我想形成像['ibm strength','ibm weekness','dell strength','dell weakness'] 这样的组合。
我尝试使用 zip 或连接列表。我也使用了 itertools 但它没有给我想要的输出。请帮忙。
a = ['ibm','dell']
b = ['strength','weekness']
c = a + b
itertools.combinations(c,2)
for a in a:
for b in b:
print a +b
【问题讨论】:
标签: python list python-2.7 combinations