关于could not convert string to float 的问题(语言-python)

img

img

img


def main():
    x,y=loadIris()
    liner=linear_model.LinearRegression()
    liner.fit(x,y)
    showLR(liner,x,y)
    y=input("请输入萼片宽度(单位 cm): ").split(' ')
    newWidth = np.array([[int(i)] for i in y if i != ''])
    print("预测的萼片长度是{:.2} cm".format(liner.predict(newWidth)[0]))

你在输入值的时候,是都有加空格吗?

img

img

img

img

img

img


谢谢,x那个已经改过了,但不要float()的话还会有错