个人比较喜欢用第三种方法
var = "This is a string"
varName = 'var'
s= locals()[varName]
s2=vars()[varName] print s
print s2
print eval(varName)
2023-12-27 12:47:39
个人比较喜欢用第三种方法
var = "This is a string"
varName = 'var'
s= locals()[varName]
s2=vars()[varName] print s
print s2
print eval(varName)