0

I have 8 dictionaries with a key, followed by a value. It looks like this (simplified):

dictionary1 = {1: '5', 2: '8', 3: '4'} 
dictionary2 = {1: '3', 2: '5', 3: '7'}
dictionary3 = {1: '1', 2: '2', 3: '3'}

I want to merge these into a dictionary that looks like this:

dictotal = {1: '5', '3', '1', 2: '8', '5', '2', 3: '4', '7', '3'}

How can I do this?

Zero Piraeus
  • 56,143
  • 27
  • 150
  • 160
Joel
  • 175
  • 1
  • 3
  • 7
  • Can you add all 8 dictionary and its output dictionary because from above details, hard to find way of programming. – Vivek Sable May 13 '15 at 11:35
  • This is not a dictionary. This is some weird mixed type that you created. – Malik Brahimi May 13 '15 at 11:38
  • Your values should be in a list, then it works. Use zip to combine values based on key. – jester112358 May 13 '15 at 11:45
  • dictotal = {1: '5', '3', '1', 2: '8', '5', '2', 3: '4', '7', '3'} this is not a dictionary. Do you want some thing like dictotal = {1: ['5', '3', '1'], 2: ['8', '5', '2'], 3: ['4', '7', '3']} ? – Pradip Das Nov 18 '15 at 03:45

0 Answers0