Exec函数
exec('var%d=%d'%(1,1))
print(var1)
命名空间字典
locals()['var2'] = 2
print(var2)
类中字典
class varclass:
def __init__(self):
self.__dict__['var3'] = 3
print(self.var3)
varclass()
标签:__,varclass,调用,var3,var2,python,self,print,变量名
来源: https://www.cnblogs.com/bai2018/p/14703678.html