thi*_*pan 8 python typeerror valueerror
我无法完全理解Python3x中Type和Value错误之间的区别.
当我尝试使用float('string')而不是TypeError时,为什么会得到ValueError?不应该给出一个TypeError因为我传递一个'str'类型的变量要转换成float?
In [169]: float('string')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-169-f894e176bff2> in <module>()
----> 1 float('string')
ValueError: could not convert string to float: 'string'
Run Code Online (Sandbox Code Playgroud)