- merging or adding of two dictionaries this feature available from python 3.5 + versions on words.
Example:
x={'a':1,'b':2}
y={'c':3,'d':4}
z={'a':5,'b':6}
p={'a':5,'b':7}
xy={**x,**y}
print(xy)
xz={**x,**z}
print(xz)
zp={**z,**p}
print(zp)
Output:
{'a': 1, 'b': 2, 'c': 3, 'd': 4}
{'a': 5, 'b': 6}
{'a': 5, 'b': 7}
No comments:
Post a Comment