Python eval函数和实例方法

时间:2016-11-29 19:40:42

标签: python python-2.7

如何通过python eval方法计算字符串类实例方法的字符串表示名称 例如

f=eval(raw_input())

输入: 上

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 1, in <module> NameError: name 'upper' is not defined

0 个答案:

没有答案