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fAbEz@|Dx@~BvAnBz@~@' A["a","b","c"]。我试图将它们组合成具有以下结构

的单个JSON文件
B[1,2,3]

到目前为止,我已经尝试过

[{
    "A": "a",
    "B": 1
  },
  {
    "A": "b",
    "B": 2
  },
  {
    "A": "c",
    "B": 3
  }
]

但这不会产生我想要的结果。

感谢任何帮助或想法。

1 个答案:

答案 0 :(得分:1)

您可以使用zip

a = ["a","b","c"]
b = [1,2,3]
result = [{'A':c, 'B':d} for c, d in zip(a, b)]

输出:

[{'A': 'a', 'B': 1}, {'A': 'b', 'B': 2}, {'A': 'c', 'B': 3}]