Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个大型二进制文件,我想将其读取为 48x1414339 数组。我是这样读的:
f = open(fname, 'rb') s = f.read() import array a = array.array('f',s)
但这给了我一个一维字符串。有没有办法让列保持不同?
将它包装在一个类中并实现例如__getitem__()将索引对转换为线性索引。除非您打算单独使用行,否则使用单独的数组可能只会增加开销。
__getitem__()