Python Forum
What is the best way to add entries from 1 dictionary to another?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is the best way to add entries from 1 dictionary to another?
#3
From python 3.9 there are also union operators for dicts! - PEP 584 Smile

so this:
d = {'a': 1, 'b': 2}
d.update({'d': 4}
can be also written this way:
d = {'a': 1, 'b': 2}
d |= {'d': 4}
Reply


Messages In This Thread
RE: What is the best way to add entries from 1 dictionary to another? - by mlieqo - Oct-20-2020, 03:27 PM

Forum Jump:

User Panel Messages

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