Python Dict Assigning Key-Value in loop
Python Dict Assigning Key-Value in loop I have a list of variables: [var1, var2, var3, var4]. For var1, I tried the following and it works. d = dict(var1=True) f = bdd.cube(d) Now I want to loop through all variables and for each variable assign the value True. The bdd.cube function can only take the argument d fully and not as name,value separately. I tried to do the following, but gives me an assertion error: AssertionError: undefined variable "var", known variables are:{var1:3, var2:11, var3:2, var4:8} for var in variables: d = dict(var=True): f = bdd.cube(d) Please let me know how to do this. The declaration of variables are as follows: Cvar = Enum('Cvar', 'var1 var2 var3 var 4', module=__name__) Attributes = [CVar] variables = List_of_Variables(Attributes) def List_of_Variables(a): v = w = for attribute in a: w = ['%s' %(i) for i in list(attribute)] return w What is t...