Skip to content

Instantly share code, notes, and snippets.

@matthewpoer
Created December 17, 2021 15:30
Show Gist options
  • Save matthewpoer/d545d1adb7d3df7b1bc076c04a4fcc78 to your computer and use it in GitHub Desktop.
Save matthewpoer/d545d1adb7d3df7b1bc076c04a4fcc78 to your computer and use it in GitHub Desktop.
demo python object merge method
matthewpoer@magpie sdp % python3
Python 3.9.7 (default, Oct 13 2021, 06:45:31)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> object_one = {"primary key":"super duper"}
>>> object_two = {"primary key":"override", "additional key":"so fun"}
>>> object_one.update(object_two)
>>> object_one
{'primary key': 'override', 'additional key': 'so fun'}
>>> object_one = {"primary key":"super duper"}
>>> object_three = {}
>>> object_one.update(object_three)
>>> object_one
{'primary key': 'super duper'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment