D:\anaconda\envs\mytest\python.exe D:/PyCharm/learning/1/11.py Traceback (most recent call last): File "D:\PyCharm\learning\1\11.py", line 158, in <module> n.train(train_input) File "D:\PyCharm\learning\1\11.py", line 135, in train inputs = j[0:self.num_in - 1] TypeError: 'float' object is not subscriptable
时间: 2023-07-22 08:08:53 浏览: 45
这个错误是因为你试图对一个浮点数对象进行下标操作,但是浮点数对象是不可被下标的。根据你提供的代码,错误发生在第135行,这行代码尝试对一个名为`j`的浮点数对象进行下标操作。可能是在这之前的代码逻辑有问题,导致`j`被赋值为一个浮点数。你可以检查一下第135行之前的代码,看看是否有地方将`j`赋值为了一个浮点数。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)