【发布时间】:2014-06-18 06:59:38
【问题描述】:
我是 python 新手,下面是我的代码,
import numpy as np
val = 4**10
Q = []
for j in range(60):
a = []
for i in range(val):
tmp = (i+j)**2
a.append(tmp)
Q.append(a)
T= zip(*Q)
G = []
for t in T:
tmps2 = np.average(t)
G.append(tmps2)
以下是我的代码错误:
MemoryError Traceback (most recent call last)
C:\Python27\lib\site-packages\IPython\utils\py3compat.pyc in execfile(fname, glo
b, loc)
169 else:
170 filename = fname
--> 171 exec compile(scripttext, filename, 'exec') in glob, loc
172 else:
173 def execfile(fname, *where):
C:\Users\User\Desktop\simpl.py in <module>()
13
14
---> 15 T= zip(*Q)
16
17 G = []
MemoryError:
所以,哪位专家能给我解释一下,我的电脑还有大约 1.5GB 的可用内存。
【问题讨论】:
标签: python arrays memory numpy