python - Replacing value in dictionary -


I'm not sure how to change the value of a dictionary with the second value I b Value should be replaced with the value of a and the value of c should be replaced by the value of the code (which is a is the value of). For d_values ​​for d_keys in :

  my_dict = {"a": 1, "b": "a", "My_dict.keys ()": if d_values ​​in d_values: My_dict [d_keys] = d_values ​​  

I need my_dict to become {a: 1, b: 1, c: 1} , but my code gives me {a: a ....} with somewhere line

I think you are more confused, depending on your requirement, just what you want

 > gt; & gt; therefore values Instead of changing, '' one ': 1,' C ': 1,' B ': 1}   

dict.fromkeys (my_dict, my_dict, same ku Rebuild the entire dictionary with the capital structure, but with the value my_dict ['a']

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -