如何在Python中定义泛型变量(语法问题)
在Python中,声明一些东西是很简单的,比如说:
self.x = "something"
print self.x #outputs "something"
我想要这样的东西:
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
有没有类似的东西?有没有什么相似的替代方案?
提前谢谢你们。