Can someone please explain this to me? This doesn\'t make any sense to me.
I copy a dictionary into another and edit the second and both are changed. Why is this hap
When you assign dict2 = dict1, you are not making a copy of dict1, it results in dict2 being just another name for dict1.
dict2 = dict1
dict1
dict2
To copy the mutable types like dictionaries, use copy / deepcopy of the copy module.
copy
deepcopy
import copy dict2 = copy.deepcopy(dict1)