梁斌老师你好,汇率1.0用您的和我自己的代码都跑不出来

#coding:utf-8
rmb_str_value = input('请输入人民币(CNY)金额:')

rmb_value= eval(rmb_str_value)

usd_vs_rmb = 6.77

usd_value = rmb_value / usd_vs_rmb

print('美元(USD)金额:', usd_value)
请输入人民币(CNY)金额:1000
Traceback (most recent call last):
  File "C:/Users/K541U/PycharmProjects/untitled5/#currencyv10.py", line 4, in <module>
    rmb_value= eval(rmb_str_value)
TypeError: eval() arg 1 must be a string or code object

Process finished with exit code 1

fish - Hadooper

赞同来自:

image.png
你的Python版本是多少?

要回复问题请先登录注册