Write values of Python dictionary back to file
问题 I extracted information from two XML files into 2 dictionaries because I wanted to compare these files and change information in one of them. These are my dictionaries: source dictionary: d_source={'123': 'description_1', '456': 'description_2'} target dictionary: d_target={'123': '\n', '456': 'description_2'} This is my replacement code: for i in d_source: for j in d_target: if d_target[j]=='\n': d_target[j]=d_source[i] print (d_target) d_target is updated to d_target = {'123': 'description