0

I have multiple dictionaries, where every dictionary has the same keys but different values, for example:

  • Dict 1: {"a":1,"b":2,"c":3}
  • Dict 2: {"a":4,"b":7,"c":1}
  • Dict 3: {"a":6,"b":5,"c":6}
  • ...

Is there an elegant way to merge these dictionaries into one which should be looking something like this?

{"a":[1,4,6],"b":[2,7,5],"c":[3,1,6]}

Or would it even be more useful to simply put all dictionaries into a list like this:

[{"a":1,"b":2,"c":3},{"a":4,"b":7,"c":1},{"a":6,"b":5,"c":6}]
Luca Tatas
  • 160
  • 1
  • 14

0 Answers0