ValueError: invalid literal for int() with base 10: ‘1.4‘

问题背景

在练习python经典面试题时,使用int方法报错

int('1.4')
ValueError: invalid literal for int() with base 10: '1.4'

问题解决

int方法不能对字符串产生作用

int(1.4)

在这里插入图片描述
成功输出

猜你喜欢

转载自blog.csdn.net/weixin_55579895/article/details/121397109