如何排列组合合并Python里两个list的元素

2025-05-16 20:53:44
推荐回答(2个)
回答1:

排列组合合并Python里两个list的元素
import itertools

a,b=[1,2,3],[4,5,6]
print(list(itertools.product(a,b)))

回答2:

L1=[1]
L2=[2]
L3=L1+L2