ValueError: invalid literal for int() with base 10 Posted on 2013 年 11 月 05 日2013 年 11 月 05 日 by 键盘侠 python需要进行int转型的字符串仅仅包含数字,这时候用round(float(“1.0”)) >>> int(1.0) 1 >>> int(‘1.0’) Traceback (most recent call last): File “<stdin>”, line 1, in <module> ValueError: invalid literal for int() with base 10: ‘1.0’ >>> round(float(‘1.0’)) 1.0 >>> int(round(float(‘1.0’))) 1 >>> 打赏赞微海报分享