个人比较喜欢用第三种方法
var = "This is a string" varName = 'var' s= locals()[varName] s2=vars()[varName] print s print s2 print eval(varName)
posted on 2018-03-02 12:18 星河赵 阅读(11946) 评论(0) 编辑 收藏 举报