eval()函数: 将字符串当成有效的表达式来求职并返回计算结果 案例: 提示用户输入一个加减乘除混合运算,返回计算结果 input_str=input("请输入算术题:") print(eval(input_str))