python spread operator dictionary code example
Example 1: spread object python
>>> d = {'x': '2', 'y': '1'}
>>> {**d, 'x':1}
{'x': 1, 'y': '1'}
Example 2: python spread operator
arr = [3, 4, 5]
extended_arr = [1, 2, *arr]
>>> d = {'x': '2', 'y': '1'}
>>> {**d, 'x':1}
{'x': 1, 'y': '1'}
arr = [3, 4, 5]
extended_arr = [1, 2, *arr]