个人比较喜欢用第三种方法

var = "This is a string"
varName = 'var'
s= locals()[varName]
s2=vars()[varName] print s
print s2
print eval(varName)
05-08 08:31