python 中 eval 对字符串数值进行计算
001、
>>> eval("10 + 100") ## 对字符串数值进行计算 110 >>> eval("10 - 100") -90 >>> eval("10 * 100") 1000 >>> eval("10 / 100") 0.1 >>> eval(10 / 100) ## 参数需要是字符串 Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: eval() arg 1 must be a string, bytes or code object
。