Python第三方库h5py——读取mat文件并显示值

mat数据格式是Matlab默认保存的数据格式。在Python中,我们可以使用h5py库来读取mat文件。

>>> import h5py
>>> data = h5py.File("**.mat")
>>> test = data["digitStruct/name"] #
>>> st = test[0][0] #
>>> obj = data[st] #"b": shape (5, 1), type ">
>>> str = "".join(chr(i) for i in obj[:])
>>> str
'1.png'

你可能感兴趣的:(编程语言Python)