我想加载numpy
个文件以输入CNN,但我得到了这个IndexError
。我不知道为什么
任何帮助都将不胜感激
while(line.strip()!=""):
print('linex: ', line)
print('\n')
if("SEIZURE" in line):
line=f.readline()
if(len(line.split(' '))>=3):
preictalSpectograms.append([])
cont=cont+1
preictalSpectograms[cont].append(line.split(' ')[2].rstrip())
indFilePathRead=indFilePathRead+1
else:
if(len(line.split(' '))>=3):
preictalSpectograms[cont].append(line.split(' ')[2].rstrip())
indFilePathRead=indFilePathRead+1
由于您没有发布所有相关的代码,因此很难给您提供一个有保证的解决方案,但我猜想您在执行第一个
append()
调用之前就在增加cont
,因此您实际上从未附加到列表中的第一项相关问题 更多 >
编程相关推荐