问题标签 [indexoutofrangeexception]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - IndexError - '列表索引超出范围'
这是具体的错误回溯:
在代码中,之前的部分是:
我试图做的是让用户点击生成的图表中的一个正方形,一旦他们点击,它就会检查数字是多少。这告诉它这个数字可能是范围明智的。
特定文件是minsweeper_game_study.py
,执行该文件所需的其他文件。
sql-server - 舍入数据时出现 IndexOutOfRangeException
我有以下stored procedure
我有以下VB.Net
代码可以访问它:
问题是我的代码IndexOutOfRangeException
在
请注意,当我访问没有该round
函数的存储过程时,它可以正常工作,因此它与我的圆形函数有关。请注意,我的 Fields和TotalLoading
是money 类型。是不是因为这个?TotalRedemption
CardBalance
python - 来自 Python 循环的索引错误
出于某种原因,我不断收到以下代码的索引超出范围错误!我要做的就是将下一个数据项与当前数据项进行比较以检查冗余。
python - IndexError:列表索引超出范围,不知道为什么
我希望程序做的是获取与某个条形码相关的序列并执行定义的功能(序列的平均长度和标准偏差,减去条形码和不相关的 txt,由相同的条形码识别)。我写了一些类似的东西,并基于类似的程序,但我不断收到索引错误。这个想法是所有带有第一个条形码的序列都将被处理为barcodeCounter = 0,第二个被处理为barcodeCounter = 1,等等。希望这是足够的信息,如果它是混乱的,抱歉。
输入:
输出:
这是我基于它的代码。
编辑:添加了 enumerate 函数并注释掉了barcodeCounter的东西。
新错误:
没有问题的代码:
@abarnert 你很有帮助,谢谢。有时(大部分时间)在编程方面我并不是最聪明的。我还必须更改添加新序列的方式,因为它们str
不是list
.
c# - C# IndexOutOfRangeException 无法解释
我得到了一个超出范围异常的奇怪索引。
这是我的代码片段:
我放置了 try 和 catch 以查看是否可以简单地忽略异常,但这不起作用。
在 %%% 处抛出异常。有任何想法吗?我进行调试只是为了确保它不是任何一个数组,并且在这两种情况下, i 和 index 都是可以接受的。(即使 st 的长度被确认为 10,也会在 index = 1 处抛出)
list - 创建总和列表
我是 Python 的新手,我正在努力创建一个由 for 循环生成的总和列表。
我有一个学校作业,我的程序必须在多项选择测试中模拟一班盲人学生的分数。
当我运行 class_total() 函数时,我收到此错误:
问题是:我如何评估每个学生的分数并与他们一起创建一个列表,因为这是我想用 class_total() 函数做的事情。
我也试过
但是我遇到了同样的错误,所以我认为我还不完全理解列表在 Python 中是如何工作的。
谢谢!
(另外,我不是英语母语,所以如果我不够清楚,请告诉我)
c# - 分配数组的变量
我正在尝试为我的 second( ) 数组var1-4
的四个部分分配变量() 。lines2
目前,我遇到了var1
返回我想要的数据的问题,但是控制台显示的值是我文件中实际存在的值的 8 倍。在运行时,我总是在第一个之后得到IndexOutOfRangeException
一个var
。不确定是什么导致了这些错误中的任何一个。
编辑:来自文本文件的数据 - 每个都由一个选项卡分隔:
c# - 尽管使用 GetLength 检查,但多维数组上的 IndexOutOfRangeException
我正在使用以下代码从 Excel 电子表格中读取值:
的类型sheets[passedVehicles]
是一个多维数组,Object[,]
上面的 for 循环IndexOutOfRange
在 i = 1 时给了我一个异常,尽管我检查了行数。
我为有问题的电子表格添加了一些日志记录,并已验证:
- i = 1 是失败的迭代
- 的值为
lastPassRow
4 - 的值
sheets[passedVehicles].GetLength(1)
也是四。
在我看来,所有值都在范围内。还有其他可能导致此异常的原因吗?
注意:我从 i = 1 开始,因为第 0 行是电子表格中的标题,不包含我要读取的数据。
naudio - 使用 Nadio WaveFileWriter 的偶尔 System.IndexOutOfRangeException
我正在使用 WaveFileWriter 处理以下异常。此异常间歇性发生——大多数情况下都可以正常工作。下面的代码片段:
以下是异常的详细信息:
c++ - Trouble with Out of range in memory using stringsteam
I just started using the stringstream for the first time and I love the concept, but I am having a hard time finding where exactly I am having an out of range in memory with my stringstream function.
What my function does is it takes in a string, for example, "N02550 G3 X16.7379 Y51.7040 R0.0115" This is machine code for a CNC machine at my job. I pass the string to a stringstream in order to find the strings that have a X, Z, Y next to them, these are coordinates. It then gets rid of the character at the beggining in order to save the float number to my struct "Coordinate"(there are 3 doubles, x, y, z).
When I run a text file that has this machine code with 33 lines, my program works. When I run it with machine code of 718 lines, it gets to 718, then crashes with out of range memory. Then another weird part is when I run machine code with 118,000 lines, it goes up to around 22,000 lines then crashes. So I'm having trouble figuring out why it is able to do that and whats causing the problem.
Here is the function:
If you want to see the whole application(the application is well documented) then ask or if you need the txt files containing the machine code. Thank you!