下面是python里面的字符串转化为变量的3种方法,如果大家还有方法,请指出,多谢!
var = "This is a string"
varName = 'var'
s= locals()[varName]
s2=vars()[varName]
print(s)
print(s2)
下面是python里面的字符串转化为变量的3种方法,如果大家还有方法,请指出,多谢!
var = "This is a string"
varName = 'var'
s= locals()[varName]
s2=vars()[varName]
print(s)
print(s2)