嗨,我在python中使用unstack时遇到了一个问题
fileID= open('B1b1_t100000.beam','r');
npart = 1E6;
ncoord = 7;
coords = np.reshape(struct.unpack('d'*int(ncoord*npart),fileID.read()),(npart,ncoord));
fileID.close()
我得到了错误
Traceback (most recent call last):
File "transfer_lev_B1.py", line 30, in <module>
coords = np.reshape(struct.unpack('d'*int(ncoord*npart),fileID.read()),(npart,ncoord));
struct.error: unpack requires a string argument of length 56000000
我真的看不出问题出在哪里。文件字节大小为56000000。在先前的np=1E4尝试中,代码用于具有相同格式的不同文件(总行数较少)。但是当我转到一个包含更多行的更大的文件时会遇到问题。。你知道吗
好吧,我解决了我的问题
相关问题 更多 >
编程相关推荐