📌  相关文章
📜  valueerror: int() 以 10 为底的无效文字:'id' - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:07.283000             🧑  作者: Mango

代码示例2
#another way is to check if the entered number isdigit()
#that way you will ensure unhandled exception incase of erroneus data

number= input("What is your weight:")
if number.isdigit():
    kilos=int(float(number))
    print ("The weight of the person is:" + str(kilos))
else:
    print("Error - Please enter a proper weight")