使用itertools:
import itertools
d ={'1':['a','b'], '2':['c','d']}
for combo in itertools.product(*[d[k] for k in sorted(d.keys())]):
print(''.join(combo))
data={1:['a','b'],2:['c','d','i'],3:['p','o','l']}
lstt=[]
for k,v,p in data.values():
for i in range(len(v)):
print(p[i])
lstt.append(v[i])
print(lstt)