小编Inf*_*rno的帖子

"无法隐式地将'float'对象转换为str"

>>> def main():
        fahrenheit = eval(input("Enter the value for F: "))
        celsius = fahrenheit - 32 * 5/9
        print("The value from Fahrenheit to Celsius is " + celsius)
>>> main()
Enter the value for F: 32
Traceback (most recent call last):  
  File "<pyshell#73>", line 1, in <module>
    main()
  File "<pyshell#72>", line 4, in main
    print("The value from Fahrenheit to Celsius is " + celsius)
TypeError: Can't convert 'float' object to str implicitly"
Run Code Online (Sandbox Code Playgroud)

python typeerror

10
推荐指数
1
解决办法
3万
查看次数

标签 统计

python ×1

typeerror ×1