l1=['a','b','c']
l2=[1,2,3]
l3=[4,5,6]
如何转换成如下嵌套字典
{
'a':[1,4],
'b':[2,5],
'c':[3,6]
}
解决方案
x={k: list(v) for k, v in zip(l1, zip(l2, l3))}
print(x)
l1=['a','b','c']
l2=[1,2,3]
l3=[4,5,6]
{
'a':[1,4],
'b':[2,5],
'c':[3,6]
}
x={k: list(v) for k, v in zip(l1, zip(l2, l3))}
print(x)