遇到一个程序在定义计数器时,counter = 0.
就试了下加不加点的区别
![](https://img.haomeiwen.com/i5346502/32c79c5f6de52f82.png)
但是这个程序这么用会报错:
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
这是因为索引不能用浮点数。
遇到一个程序在定义计数器时,counter = 0.
就试了下加不加点的区别
但是这个程序这么用会报错:
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
这是因为索引不能用浮点数。
本文标题:数字
本文链接:https://www.haomeiwen.com/subject/ociakqtx.html
网友评论