Created
December 17, 2021 15:30
-
-
Save matthewpoer/d545d1adb7d3df7b1bc076c04a4fcc78 to your computer and use it in GitHub Desktop.
demo python object merge method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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