如何解决内存错误

时间:2016-07-06 07:48:40

标签: python

这是我的python代码

enter code here fileName = open(flename,“r”)     dccount = 0     dcCycles = []     ccCycles = []     温度= 0     ccCY = []     dcCY = []     对于fileName中的行:         长度= len(线)         对于范围(长度)的i:             如果我> = 4:                 x =行[i-1]                 y =行[i]                 bcValue = x + y                 如果bcValue ==“IV”:                     ivval = float(int(line [i + 2:i + 7]))                     如果ivval> 0:                         如果temp == 1:                             dcCY.append(dcCycles)                             dcCycles = []                             cc =行[dccount:i-5]                             ccCycles.append(CC)                             dccount = i                             temp = 0                         其他:                             cc =行[dccount:i-5]                             ccCycles.append(CC)                     其他:                         如果temp == 0:                             ccCY.append(ccCycles)                             ccCycles = []                             dc = line [dccount:i-6]                             dcCycles.append(DC)                             dccount = i                             temp = 1                         其他:                             dc = line [dccount:i-6]                             dcCycles.append(DC)

fileName.close()

内存中的错误 cc = line [dccount:i-5] 此灵如何解决请帮帮我

1 个答案:

答案 0 :(得分:0)

看起来dccount尚未定义。你应该得到一个NameError