Consider I have the following dictionary:
dic={}
dic["var1"]=val1
dic["var2"]=val2
Now I have another object which contains two properties: var1 and var2 .
I would like to run a loop within the object’s method such as (pseudo code):
for key, value in dic
self.key=value
so that self.var1=val2 and self.var2=val2
How can I implement it in python?
Meir
Here I am obligated to say something like “why not just use a dict?”