With Python it is easy to declare something like
self.x = "something"
print self.x #outputs "something"
I want to have something like this:
param["key"] = "x"
self.param["key"] = "something" #here I actually want to access this "self" parameter as below with its value defined above
print self.x #supposed to output "something" as well. Note that "x" refers to value defined in the first line
Is there any such thing? Is there any similar alternatives?
Thanks in advance.
Use
setattr—setattr(self, param['key'], 'something').