从python数组创建元素智能字典

leo*_*hel 3 python arrays dictionary elementwise-operations

从这些数组:

t = ["A","B","C"]
a = [1,2,3]
b = [4,5,6]
c = [7,8,9]
Run Code Online (Sandbox Code Playgroud)

我怎样才能获得这样的列表

[
  { 'A':1, 'B':4, 'C':7},
  { 'A':2, 'B':5, 'C':8},
  { 'A':3, 'B':6, 'C':9},
]
Run Code Online (Sandbox Code Playgroud)

这样在JSON中转储更有用吗?

lll*_*lll 5

你可以这样做:

t_data = [a, b, c]
[{u:v for u, v in zip(t, xs)} for xs in zip(*t_data)]
Run Code Online (Sandbox Code Playgroud)