内存错误从字典值中减去排序列表中的值

时间:2017-02-01 00:23:22

标签: python python-2.7 dictionary memory

我有一个带有Ref_ID的字典用于街道链接,因为键和序列在该街道上作为值停止。我想确定停止是否不按顺序。我有一个由1234567这样的项组成的字典:[5,10,15,35,]其中数组表示给定块上的序列。

我在for循环中使用while循环,迭代遍历每个值,直到count = 2,将值附加到元组,然后从第二个值中减去第一个值。我差异大于40我希望程序将链接存储在与其关联的路径下的另一个列表中。

我在运行脚本时遇到内存错误:

eCheck = []
oCheck = []

for key, value in eLinks.items():
    for k in value:
        eValues.append(k)
        eList = sorted(eValues)
    for i in eList:
        eValuescount = 0
        while eValuescount < 2:
            eCheck.append(k)
            eItemscount += 1
        x = eValues[1] - eValues[0]
        print x
        if x > 40:
            eCheckStreet.append(key)

print "Route ", route, " even side"
for link in eCheckStreet:
    print link

这是错误:

Traceback (most recent call last):
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 323, in RunScript
    debugger.run(codeObject, __main__.__dict__, start_stepping=0)
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\debugger\__init__.py", line 60, in run
    _GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\debugger\debugger.py", line 654, in run
    exec cmd in globals, locals
  File "N:\Python\Completed scripts\Check_Sequences.py", line 1, in <module>
    import arcpy
MemoryError

0 个答案:

没有答案