1

I have a list of tuples wherein each tuple has a number of dictionaries that i want to merge into one (i.e. within each tuple there'll be just one dictionary). Say for example,

payload = [
           (
            {"foo1":"value1"},
            {"bar1":"value1"}
           ),
           (
            {"foo2":"value2"},
            {"bar2":"value2"}
           )
          ]

and what i want to achieve is something like this:

payload = [
           {"foo1":"value1","bar1":"value1"},
           {"foo2":"value2","bar2","value2"}
          ]
Aman Singh
  • 1,111
  • 3
  • 17
  • 31
  • 4
    Great, you've got a good sample input and desired output. Have you tried writing any code? That's the next step. – John Zwinck May 06 '18 at 09:55
  • Before someone complains about the dupe because "that's not the same thing": Yes it is. It absolutely is just merging a list of dicts into a single dict. Just because it has to be done multiple times doesn't make it a different question. I'm confident you'll manage to wrap the code in a loop that iterates over `payload` and merges the dicts in all the tuples. – Aran-Fey May 06 '18 at 10:03

0 Answers0