4 ms·
Good advice. I've got one to add: #x and y are dictionaries z = dict(x.items() + y.items()) It merges two dictionaries, giving precedence to the second (i
by simon_weber 14y ago
Good advice. I've got one to add:
#x and y are dictionaries
z = dict(x.items() + y.items())
It merges two dictionaries, giving precedence to the second (in Python 2 - Python 3 is a bit more nasty: http://stackoverflow.com/questions/38987/how-can-i-merge-union-two-python-dictionaries-in-a-single-expression http://stackoverflow.com/questions/38987/how-can-i-merge-uni...).