ValueError: invalid literal for int() with base 10

来源:互联网 发布:深圳号码数据 编辑:程序博客网 时间:2024/05/21 17:46
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '1.0'

如果写int("1.0")就会错误,因为python假设需要进行int转型的字符串仅仅包含数字,这时候用round(float("1.0"))就ok了。
原创粉丝点击