Is there a way to save the values for list items in dict values and change the list through dict?
a = [1, 2] b = [11, 22] d = {k: v for k, v in zip(a, b)} d[1] = 33 print b, d
Second Print Output:
[11, 22] {1: 33, 2: 22}
For now, I would like to:
[33, 22] {1: 33, 2: 22}
I suspect that both the dictionary creator and the modification are wrong ...
In C, one could store pointers in a dictionary and change the value using the * operator.
Anything like this in python or any other pythonic way to achieve this?
source share