Python Forum
Merging Dictionaries - Optimum Style?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Merging Dictionaries - Optimum Style?
#3
Just to keep in mind that dictionary keys are/must be unique and if there are same keys in dictionaries to be merged they will be overwritten without warning and only the last will remain.

>>> a = {'fr': 'France'} 
>>> b = {'sk': 'Slovakia'} 
>>> c = {'fr': 'Francia'}                                                                  
>>> {**a, **b, **c}                                                                        
{'fr': 'Francia', 'sk': 'Slovakia'}
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
Merging Dictionaries - Optimum Style? - by adt - Oct-09-2019, 06:45 AM
RE: Merging Dictionaries - Optimum Style? - by perfringo - Oct-09-2019, 07:24 AM
RE: Merging Dictionaries - Optimum Style? - by adt - Oct-09-2019, 08:09 AM
RE: Merging Dictionaries - Optimum Style? - by adt - Oct-09-2019, 05:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  optimum chess endgame with D=3 pieces doesn't give an exact moves_to_mate variable max22 1 304 Mar-21-2024, 09:31 PM
Last Post: max22
  merging three dictionaries Skaperen 3 2,008 Oct-20-2020, 10:06 PM
Last Post: Skaperen
  merging dictionaries Skaperen 3 2,512 Nov-13-2018, 06:26 AM
Last Post: Skaperen
  merging two dictionaries Skaperen 17 10,734 Oct-05-2017, 12:47 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020