ValueError: invalid literal for int() with base 10 分类: 问题总结 python 2013-12-09 09:12 3782人阅读 评论(0) 收藏

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了。
原文地址:https://www.cnblogs.com/think1988/p/4627996.html