Scipy 教程-SciPy 输入和输出
SciPy.io(输入和输出)包支持广泛的函数,用于处理不同格式的文件。这些格式包括:
Matlab
IDL
矩阵市场(Matrix Market)
Wave
Arff
Netcdf 等
import scipy.io as sioimport numpy as np#Save a mat filevect = np.arange(10)sio.savemat('array.mat', {'vect':vect})#Now Load the Filemat_file_content = sio.loadmat('array.mat')print(mat_file_content)
专属福利 👉点击领取:最全Python资料合集
{'__header__': b'MATLAB 5.0 MAT-file Platform: nt, Created on: Wed Nov 13 14:38:57 2019', '__version__': '1.0', '__globals__': [], 'vect': array([[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]])}
import scipy.io as siomat_file_content = sio.whosmat('array.mat')print(mat_file_content)
[('vect', (1, 10), 'int64')]
热门推荐