Python Forum

Full Version: Creating multidictionaries in one
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys! So basically, how would I save a prior of a dictionary before its values are changed. And also I want the format to be like this;

{'A':None,{'R1': [5,4,2,6,4],'R2':[6,5,4,7,4],'R3':[6,2,4,7,3]
I would like to have the user input the values for r1,r2,r3 and if there is no value make it none. How would i do that?
If you want to save a dictionary before modifying it, you can do it like so
my_dict = {1: "one", 2: "two"}
copy = dict(my_dict)
As for the second part of your question - what have you tried?